/*---------------------------------------------------------------------------* Project: SC demo File: main.c Copyright 2006 Nintendo. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. $Log: main.c,v $ Revision 1.9 08/08/2006 12:41:50 kawaset Added SCGetWpadMotorMode, SCGetWpadSensorBarPosition, SCGetWpadSpeakerVolume, SCSetWpadMotorMode, SCSetWpadSensorBarPosition, and SCSetWpadSpeakerVolume. Deleted SCEmuSetAspectRatio and SCEmuSetLanguage. Revision 1.8 06/09/2006 02:05:00 kawaset Added checking result of NANDInit(). Revision 1.7 06/05/2006 10:35:58 kawaset Do check before SCFlush*(). Revision 1.6 06/01/2006 11:08:31 kawaset Deleted timezone. Revision 1.5 05/26/2006 12:40:26 kawaset Full model change. Revision 1.4 02/17/2006 01:49:35 kawaset Changed message on exit. Revision 1.3 02/16/2006 12:56:01 hiratsu Deleted NAND* API call. Revision 1.2 02/07/2006 01:11:37 kawaset Fixed build error for RVL Revision 1.1 02/03/2006 12:57:05 kawaset Initial check-in. $NoKeywords: $ *---------------------------------------------------------------------------*/ #include #include #include #include static u32 DemoFlushCount; static u32 DemoFlushResult; static void DemoFlushCallback(u32 result) { DemoFlushResult = result; } static void DemoMain(void) { char *msg; u8 aspectRatio; u8 language; u8 euRgb60Mode; u8 progressiveMode; u8 soundMode; u8 wpadSpeakerVolume; u8 wpadMotorMode; u8 wpadSensorBarPosition; OSReport("DemoMain() called\n"); aspectRatio = SCGetAspectRatio(); switch (aspectRatio) { case SC_ASPECT_RATIO_4x3: msg = "4x3"; break; case SC_ASPECT_RATIO_16x9: msg = "16x9"; break; default: msg = "UNKNOWN"; break; } OSReport("Aspect Ratio = %s\n", msg); language = SCGetLanguage(); switch (language) { case SC_LANG_JAPANESE: msg = "Japanese"; break; case SC_LANG_ENGLISH: msg = "English"; break; case SC_LANG_GERMAN: msg = "German"; break; case SC_LANG_FRENCH: msg = "French"; break; case SC_LANG_SPANISH: msg = "Spanish"; break; case SC_LANG_ITALIAN: msg = "Italian"; break; case SC_LANG_DUTCH: msg = "Dutch"; break; default: msg = "UNKNOWN"; break; } OSReport("Language = %s\n", msg); euRgb60Mode = SCGetEuRgb60Mode(); switch (euRgb60Mode) { case SC_EURGB60_MODE_OFF: msg = "OFF"; break; case SC_EURGB60_MODE_ON: msg = "ON"; break; default: msg = "UNKNOWN"; break; } OSReport("EURGB60 Mode = %s\n", msg); progressiveMode = SCGetProgressiveMode(); switch (progressiveMode) { case SC_PROGRESSIVE_MODE_OFF: msg = "OFF"; break; case SC_PROGRESSIVE_MODE_ON: msg = "ON"; break; default: msg = "UNKNOWN"; break; } OSReport("Progressive Mode = %s\n", msg); soundMode = SCGetSoundMode(); switch (soundMode) { case SC_SOUND_MODE_MONO: msg = "MONO"; break; case SC_SOUND_MODE_STEREO: msg = "STEREO"; break; case SC_SOUND_MODE_SURROUND: msg = "SURROUND"; break; default: msg = "UNKNOWN"; break; } OSReport("Sound Mode = %s\n", msg); wpadSpeakerVolume = SCGetWpadSpeakerVolume(); OSReport("WPAD Speaker Volume = %d\n", wpadSpeakerVolume); wpadMotorMode = SCGetWpadMotorMode(); switch (wpadMotorMode) { case SC_WPAD_MOTOR_MODE_OFF: msg = "OFF"; break; case SC_WPAD_MOTOR_MODE_ON: msg = "ON"; break; default: msg = "UNKNOWN"; break; } OSReport("WPAD Motor Mode = %s\n", msg); wpadSensorBarPosition = SCGetWpadSensorBarPosition(); switch (wpadSensorBarPosition) { case SC_WPAD_SENSOR_BAR_POSITION_LOWER: msg = "Lower"; break; case SC_WPAD_SENSOR_BAR_POSITION_UPPER: msg = "Upper"; break; default: msg = "UNKNOWN"; break; } OSReport("WPAD Sensor Bar Position = %s\n", msg); } int main(void) { SCInit(); { u32 status; u32 count = 0; // Wait until SC initialize finishes do { status = SCCheckStatus(); count++; } while (status == SC_STATUS_BUSY); OSReport("SCInit finished. status = %d, count = %d\n", status, count); if (status != SC_STATUS_OK) { OSHalt("Demo failed"); } } DemoMain(); { u32 status = SCCheckStatus(); if (status == SC_STATUS_OK) { SCFlushAsync(DemoFlushCallback); while (SCCheckStatus() == SC_STATUS_BUSY) { DemoFlushCount++; } OSReport("SCFlushAsync result=%d, count=%d\n", DemoFlushResult, DemoFlushCount); } else { OSReport("SCFlushAsync was not executed due to status (%d)\n", status); } } OSReport("\n"); OSHalt("Demo complete"); return EXIT_SUCCESS; }