]> Chaos Git - corbenik/ctrulib.git/commitdiff
remove unneeded boilerplate from examples
authorDave Murphy <davem@devkitpro.org>
Fri, 9 Jan 2015 08:14:01 +0000 (08:14 +0000)
committerDave Murphy <davem@devkitpro.org>
Fri, 9 Jan 2015 08:14:01 +0000 (08:14 +0000)
examples/app_launch/source/main.c
examples/audio/mic/source/main.c
examples/gpu/source/main.c
examples/graphics/printing/hello-world/source/main.c
examples/http/source/main.c
examples/libapplet_launch/source/main.c
examples/mvd/source/main.c
examples/qtm/source/main.c
examples/templates/application/source/main.c

index d45b4acd36581db111317da48c6cb952ddeeeee6..73cecb69f4e04a6d86a9119aa1ea13db803de006 100644 (file)
@@ -6,10 +6,7 @@
 
 int main()
 {
-       srvInit(); // Needed
-       aptInit(); // Needed
        gfxInitDefault(); // Init graphic stuff
-       hidInit(NULL); // For input (buttons, touchscreen...)
 
 
        // We need these 2 buffers for APT_DoAppJump() later. They can be smaller too
@@ -46,11 +43,7 @@ int main()
        }
 
 
-       // Deinit everything before the app process get's terminated
-       hidExit();
        gfxExit();
-       aptExit();
-       srvExit();
 
        return 0;
 }
index f54823fbbc54b91bba8bc2e44fc6aa09e16d26d9..2726a75df5904f1bd293adc07c3f23941d05f4eb 100644 (file)
@@ -13,11 +13,8 @@ int main()
        u8 control=0x40;
        u32 audio_initialized = 0;
 
-       srvInit();      
-       aptInit();
        gfxInitDefault();
-       hidInit(NULL);
-       
+
        if(CSND_initialize(NULL)==0)audio_initialized = 1;
 
        sharedmem = (u32*)memalign(0x1000, sharedmem_size);
@@ -85,10 +82,7 @@ int main()
        free(sharedmem);
        linearFree(audiobuf);
 
-       hidExit();
        gfxExit();
-       aptExit();
-       srvExit();
        return 0;
 }
 
index 887e249e2fa7e33ce4b680571dc8017c9b58cfb2..3662ccde0493e1827dd7213bb82eddea104e235d 100644 (file)
@@ -114,13 +114,13 @@ const vertex_s modelVboData[]=
 //stolen from staplebutt
 void GPU_SetDummyTexEnv(u8 num)
 {
-       GPU_SetTexEnv(num, 
-               GPU_TEVSOURCES(GPU_PREVIOUS, 0, 0), 
-               GPU_TEVSOURCES(GPU_PREVIOUS, 0, 0), 
-               GPU_TEVOPERANDS(0,0,0), 
-               GPU_TEVOPERANDS(0,0,0), 
-               GPU_REPLACE, 
-               GPU_REPLACE, 
+       GPU_SetTexEnv(num,
+               GPU_TEVSOURCES(GPU_PREVIOUS, 0, 0),
+               GPU_TEVSOURCES(GPU_PREVIOUS, 0, 0),
+               GPU_TEVOPERANDS(0,0,0),
+               GPU_TEVOPERANDS(0,0,0),
+               GPU_REPLACE,
+               GPU_REPLACE,
                0xFFFFFFFF);
 }
 
@@ -128,31 +128,31 @@ void GPU_SetDummyTexEnv(u8 num)
 void renderFrame()
 {
        GPU_SetViewport((u32*)osConvertVirtToPhys((u32)gpuDOut),(u32*)osConvertVirtToPhys((u32)gpuOut),0,0,240*2,400);
-       
+
        GPU_DepthRange(-1.0f, 0.0f);
        GPU_SetFaceCulling(GPU_CULL_BACK_CCW);
        GPU_SetStencilTest(false, GPU_ALWAYS, 0x00, 0xFF, 0x00);
        GPU_SetStencilOp(GPU_KEEP, GPU_KEEP, GPU_KEEP);
        GPU_SetBlendingColor(0,0,0,0);
        GPU_SetDepthTestAndWriteMask(true, GPU_GREATER, GPU_WRITE_ALL);
-       
-       GPUCMD_AddSingleParam(0x00010062, 0); 
+
+       GPUCMD_AddSingleParam(0x00010062, 0);
        GPUCMD_AddSingleParam(0x000F0118, 0);
-       
+
        //setup shader
        SHDR_UseProgram(shader, 0);
-       
+
        GPU_SetAlphaBlending(GPU_BLEND_ADD, GPU_BLEND_ADD, GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA);
        GPU_SetAlphaTest(false, GPU_ALWAYS, 0x00);
-       
+
        GPU_SetTextureEnable(GPU_TEXUNIT0);
-       
-       GPU_SetTexEnv(0, 
-               GPU_TEVSOURCES(GPU_TEXTURE0, GPU_PRIMARY_COLOR, GPU_PRIMARY_COLOR), 
+
+       GPU_SetTexEnv(0,
                GPU_TEVSOURCES(GPU_TEXTURE0, GPU_PRIMARY_COLOR, GPU_PRIMARY_COLOR),
-               GPU_TEVOPERANDS(0,0,0), 
-               GPU_TEVOPERANDS(0,0,0), 
-               GPU_MODULATE, GPU_MODULATE, 
+               GPU_TEVSOURCES(GPU_TEXTURE0, GPU_PRIMARY_COLOR, GPU_PRIMARY_COLOR),
+               GPU_TEVOPERANDS(0,0,0),
+               GPU_TEVOPERANDS(0,0,0),
+               GPU_MODULATE, GPU_MODULATE,
                0xFFFFFFFF);
        GPU_SetDummyTexEnv(1);
        GPU_SetDummyTexEnv(2);
@@ -189,11 +189,8 @@ void renderFrame()
 
 int main(int argc, char** argv)
 {
-       //setup services
-       srvInit();      
-       aptInit();
+
        gfxInitDefault();
-       hidInit(NULL);
 
        //initialize GPU
        GPU_Init(NULL);
@@ -321,9 +318,6 @@ int main(int argc, char** argv)
        }
 
        gsExit();
-       hidExit();
        gfxExit();
-       aptExit();
-       srvExit();
        return 0;
 }
index 6dd0a4359c5f9f7675edf96c8f8b58187bcadf9c..c131d20692d9b1ffa21d02751c06e95693b69963 100644 (file)
 
 int main(int argc, char **argv)
 {
-       // Initialize services
-       srvInit();
-       aptInit();
        gfxInitDefault();
-       hidInit(NULL);
 
        //Initialize console on top screen. Using NULL as the second argument tells the console library to use the internal console structure as current one
        consoleInit(GFX_TOP, NULL);
 
-       //Move the cursor to row 15 and column 19 and then prints "Hello World!" 
+       //Move the cursor to row 15 and column 19 and then prints "Hello World!"
        //To move the cursor you have tu print "\x1b[r;cH", where r and c are respectively
        //the row and column where you want your cursor to move
        //The top screen has 30 rows and 50 columns
@@ -54,10 +50,6 @@ int main(int argc, char **argv)
                gspWaitForVBlank();
        }
 
-       // Exit services
        gfxExit();
-       hidExit();
-       aptExit();
-       srvExit();
        return 0;
 }
index c51c44b8de11219a4aa3dbbd0ffbb7e123d1d70e..ed7b867ebec937a60a0f75e5236b8ace823d9883 100644 (file)
@@ -87,10 +87,6 @@ int main()
        Result ret=0;
        httpcContext context;
 
-       // Initialize services
-       srvInit();
-       aptInit();
-       hidInit(NULL);
        gfxInitDefault();
        //gfxSet3D(true); // uncomment if using stereoscopic 3D
        httpcInit();
@@ -123,9 +119,6 @@ int main()
        // Exit services
        httpcExit();
        gfxExit();
-       hidExit();
-       aptExit();
-       srvExit();
        return 0;
 }
 
index f7bc21569b1f5b6f4b8e93d27eef4639ee5bfa93..0e0337305516325b9dc176100a64f43e2d401496 100644 (file)
@@ -4,10 +4,6 @@ int main()
 {
        u32 val, i;
 
-       // Initialize services
-       srvInit();
-       aptInit();
-       hidInit(NULL);
        gfxInitDefault();
        //gfxSet3D(true); // uncomment if using stereoscopic 3D
 
@@ -42,9 +38,6 @@ int main()
 
        // Exit services
        gfxExit();
-       hidExit();
-       aptExit();
-       srvExit();
        return 0;
 }
 
index af8be2dca7fef36c3919ad0dc5a14bbf858891ff..7e8aec4fb5eec6c1579bdf48d3d072fecd0753a8 100644 (file)
@@ -106,13 +106,7 @@ void draw_startup()
 
 int main()
 {
-       // Initialize services
-       srvInit();
-       aptInit();
-       hidInit(NULL);
        gfxInitDefault();
-       fsInit();
-       sdmcInit();
        //gfxSet3D(true); // uncomment if using stereoscopic 3D
 
        memset(logstring, 0, 256);
@@ -143,13 +137,7 @@ int main()
        if(inaddr)linearFree(inaddr);
        if(outaddr)linearFree(outaddr);
 
-       // Exit services
-       sdmcExit();
-       fsExit();
        gfxExit();
-       hidExit();
-       aptExit();
-       srvExit();
        return 0;
 }
 
index 7a8bfd67002c113fa27122d1537b9add590c374e..252e352ccd0ca554ba535ee3dd5a09e6cecf3554 100644 (file)
@@ -11,10 +11,6 @@ int main()
        qtmHeadtrackingInfo qtminfo;
        u32 colors[4] = {0x0000FF, 0x00FF00, 0xFF0000, 0xFFFFFF};
 
-       // Initialize services
-       srvInit();
-       aptInit();
-       hidInit(NULL);
        gfxInitDefault();
        //gfxSet3D(true); // uncomment if using stereoscopic 3D
 
@@ -84,9 +80,6 @@ int main()
        // Exit services
        qtmExit();
        gfxExit();
-       hidExit();
-       aptExit();
-       srvExit();
        return 0;
 }
 
index d55fbe9e3f06a466da14fdc3f7b0862b0c628ed3..633c7ff2e579967373fdcfa366155fa161951baa 100644 (file)
@@ -4,10 +4,6 @@
 
 int main()
 {
-       // Initialize services
-       srvInit();
-       aptInit();
-       hidInit(NULL);
        gfxInitDefault();
        //gfxSet3D(true); // uncomment if using stereoscopic 3D
 
@@ -36,10 +32,6 @@ int main()
                gfxSwapBuffers();
        }
 
-       // Exit services
        gfxExit();
-       hidExit();
-       aptExit();
-       srvExit();
        return 0;
 }