diff --git a/README b/README index acea714..61cba83 100644 --- a/README +++ b/README @@ -15,8 +15,10 @@ A port of DOSBox to the Wii using SDL Wii. * Wiimote pointer support * SD/USB mounting * Most DOS games are playable -* Home menu, with on-screen keyboard * Dynamic Recompiler support with core=dynamic for high performance emulation +* Home menu with: + * On-screen keyboard + * Increase/decrease cycles and frameskip -=[ Performance on Wii and vWii ]=- @@ -49,6 +51,8 @@ A port of DOSBox to the Wii using SDL Wii. For more informations about sync r4301 see docs/PORTING_Wii.txt. * Add PowerPC Dynamic Recompiler patch from jmarsh (ppc_dynrec.diff and drive_fat_BE.diff) see: https://www.vogons.org/viewtopic.php?t=65057 +* Start including features from modified Version 1.7 R1 (wiimpathy) + * New top menu buttons for cycles and frameskip. [1.7 - June 30, 2012] diff --git a/src/cpu/cpu.cpp b/src/cpu/cpu.cpp index c4d8c38..2081b70 100644 --- a/src/cpu/cpu.cpp +++ b/src/cpu/cpu.cpp @@ -2432,3 +2432,17 @@ void CPU_Init(Section* sec) { } //initialize static members bool CPU::inited=false; + +#ifdef HW_RVL +void MENU_CycleIncreaseOrDecrease(bool increase) +{ + if (increase) + { + CPU_CycleIncrease(true); + } + else + { + CPU_CycleDecrease(true); + } +} +#endif diff --git a/src/gui/render.cpp b/src/gui/render.cpp index 6db94cf..1875cc1 100644 --- a/src/gui/render.cpp +++ b/src/gui/render.cpp @@ -631,3 +631,16 @@ void RENDER_Init(Section * sec) { GFX_SetTitle(-1,render.frameskip.max,false); } +#ifdef HW_RVL +void MENU_IncreaseOrDecreaseFrameSkip(bool increase) +{ + if (increase) + { + IncreaseFrameSkip(true); + } + else + { + DecreaseFrameSkip(true); + } +} +#endif diff --git a/src/gui/sdlmain.cpp b/src/gui/sdlmain.cpp index f4c1e48..e1250c5 100644 --- a/src/gui/sdlmain.cpp +++ b/src/gui/sdlmain.cpp @@ -33,6 +33,7 @@ #endif #ifdef HW_RVL #include +#include #endif #include "cross.h" @@ -293,8 +294,22 @@ void GFX_SetTitle(Bit32s cycles,int frameskip,bool paused){ char title[200] = { 0 }; static Bit32s internal_cycles = 0; static int internal_frameskip = 0; - if (cycles != -1) internal_cycles = cycles; - if (frameskip != -1) internal_frameskip = frameskip; + if (cycles != -1) + { + internal_cycles = cycles; +#ifdef HW_RVL + MENU_CyclesDisplay = cycles; +#endif + } + if (frameskip != -1) + { + internal_frameskip = frameskip; +#ifdef HW_RVL + MENU_FrameskipDisplay = frameskip; +#endif + } + +#ifndef HW_RVL // set title only if it is NOT the wii. For wii it makes no sense if(CPU_CycleAutoAdjust) { sprintf(title,"DOSBox %s, CPU speed: max %3d%% cycles, Frameskip %2d, Program: %8s",VERSION,internal_cycles,internal_frameskip,RunningProgram); } else { @@ -303,6 +318,7 @@ void GFX_SetTitle(Bit32s cycles,int frameskip,bool paused){ if (paused) strcat(title," PAUSED"); SDL_WM_SetCaption(title,VERSION); +#endif } static unsigned char logo[32*32*4]= { diff --git a/src/platform/wii/menu.cpp b/src/platform/wii/menu.cpp index b6304bd..d2b35d7 100644 --- a/src/platform/wii/menu.cpp +++ b/src/platform/wii/menu.cpp @@ -19,10 +19,17 @@ #include "libwiigui/gui.h" #include "wiihardware.h" +#include "menu.h" +#include "cpu.h" #define THREAD_SLEEP 100 #define APPVERSION "1.7" + +int MENU_CyclesDisplay = 0; +int MENU_FrameskipDisplay = 0; + + static GuiImageData * pointer[4]; static GuiWindow * mainWindow = NULL; static GuiButton * logoBtn = NULL; @@ -305,6 +312,25 @@ static void DisplayCredits(void * ptr) LWP_CreateThread (&creditsthread, WindowCredits, NULL, NULL, 0, 60); } +static void updateCyclesText(GuiText * cycleText) +{ + char tmpCyclesTxt[15]; + if (CPU_CycleAutoAdjust) { + sprintf(tmpCyclesTxt, "%d%%", MENU_CyclesDisplay); + } + else { + sprintf(tmpCyclesTxt, "%d", MENU_CyclesDisplay); + } + cycleText->SetText(tmpCyclesTxt); +} + +static void updateFskipText(GuiText * fskipText) +{ + char tmpFskipTxt[15]; + sprintf(tmpFskipTxt, "%d", MENU_FrameskipDisplay); + fskipText->SetText(tmpFskipTxt); +} + /**************************************************************************** * HomeMenu ***************************************************************************/ @@ -367,6 +393,70 @@ void HomeMenu () logoBtn->SetTrigger(&trigA); logoBtn->SetUpdateCallback(DisplayCredits); + GuiText cycleText(NULL, 20, (GXColor){255, 255, 255, 255}); + cycleText.SetPosition(-215, -180); + updateCyclesText(&cycleText); + + GuiText fskipText(NULL, 20, (GXColor){255, 255, 255, 255}); + fskipText.SetPosition(-45, -180); + updateFskipText(&fskipText); + + GuiText cycleDecBtnTxt("-", 24, (GXColor){0, 0, 0, 255}); + GuiImageData cycleDec(keyboard_key_png); + GuiImage cycleDecImg(&cycleDec); + GuiImageData cycleDecOver(keyboard_key_over_png); + GuiImage cycleDecOverImg(&cycleDecOver); + GuiButton cycleDecBtn(cycleDec.GetWidth(), cycleDec.GetHeight()); + cycleDecBtn.SetImage(&cycleDecImg); + cycleDecBtn.SetImageOver(&cycleDecOverImg); + cycleDecBtn.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); + cycleDecBtn.SetPosition(-270, -180); + cycleDecBtn.SetLabel(&cycleDecBtnTxt); + cycleDecBtn.SetTrigger(&trigA); + cycleDecBtn.SetEffectGrow(); + + GuiText cycleIncBtnTxt("+", 24, (GXColor){0, 0, 0, 255}); + GuiImageData cycleInc(keyboard_key_png); + GuiImage cycleIncImg(&cycleInc); + GuiImageData cycleIncOver(keyboard_key_over_png); + GuiImage cycleIncOverImg(&cycleIncOver); + GuiButton cycleIncBtn(cycleInc.GetWidth(), cycleInc.GetHeight()); + cycleIncBtn.SetImage(&cycleIncImg); + cycleIncBtn.SetImageOver(&cycleIncOverImg); + cycleIncBtn.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); + cycleIncBtn.SetPosition(-160, -180); + cycleIncBtn.SetLabel(&cycleIncBtnTxt); + cycleIncBtn.SetTrigger(&trigA); + cycleIncBtn.SetEffectGrow(); + + GuiText fskipDecBtnTxt("-", 24, (GXColor){0, 0, 0, 255}); + GuiImageData fskipDec(keyboard_key_png); + GuiImage fskipDecImg(&fskipDec); + GuiImageData fskipDecOver(keyboard_key_over_png); + GuiImage fskipDecOverImg(&fskipDecOver); + GuiButton fskipDecBtn(fskipDec.GetWidth(), fskipDec.GetHeight()); + fskipDecBtn.SetImage(&fskipDecImg); + fskipDecBtn.SetImageOver(&fskipDecOverImg); + fskipDecBtn.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); + fskipDecBtn.SetPosition(-80, -180); + fskipDecBtn.SetLabel(&fskipDecBtnTxt); + fskipDecBtn.SetTrigger(&trigA); + fskipDecBtn.SetEffectGrow(); + + GuiText fskipIncBtnTxt("+", 24, (GXColor){0, 0, 0, 255}); + GuiImageData fskipInc(keyboard_key_png); + GuiImage fskipIncImg(&fskipInc); + GuiImageData fskipIncOver(keyboard_key_over_png); + GuiImage fskipIncOverImg(&fskipIncOver); + GuiButton fskipIncBtn(fskipInc.GetWidth(), fskipInc.GetHeight()); + fskipIncBtn.SetImage(&fskipIncImg); + fskipIncBtn.SetImageOver(&fskipIncOverImg); + fskipIncBtn.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); + fskipIncBtn.SetPosition(0, -180); + fskipIncBtn.SetLabel(&fskipIncBtnTxt); + fskipIncBtn.SetTrigger(&trigA); + fskipIncBtn.SetEffectGrow(); + GuiText exitBtnTxt("Exit", 24, (GXColor){0, 0, 0, 255}); GuiImage exitBtnImg(&btnLargeOutline); GuiImage exitBtnImgOver(&btnLargeOutlineOver); @@ -464,6 +554,12 @@ void HomeMenu () w.Append(logoBtn); w.Append(&closeBtn); w.Append(&exitBtn); + w.Append(&cycleText); + w.Append(&fskipText); + w.Append(&cycleDecBtn); + w.Append(&cycleIncBtn); + w.Append(&fskipDecBtn); + w.Append(&fskipIncBtn); w.Append(&keyboardBtn); mainWindow->Append(&screenImg); @@ -555,6 +651,30 @@ void HomeMenu () if(dosboxCommand[0] != 0) break; } + else if (cycleDecBtn.GetState() == STATE_CLICKED) + { + cycleDecBtn.ResetState(); + MENU_CycleIncreaseOrDecrease(false); + updateCyclesText(&cycleText); + } + else if (cycleIncBtn.GetState() == STATE_CLICKED) + { + cycleIncBtn.ResetState(); + MENU_CycleIncreaseOrDecrease(true); + updateCyclesText(&cycleText); + } + else if (fskipDecBtn.GetState() == STATE_CLICKED) + { + fskipDecBtn.ResetState(); + MENU_IncreaseOrDecreaseFrameSkip(false); + updateFskipText(&fskipText); + } + else if (fskipIncBtn.GetState() == STATE_CLICKED) + { + fskipIncBtn.ResetState(); + MENU_IncreaseOrDecreaseFrameSkip(true); + updateFskipText(&fskipText); + } } ShutoffRumble(); diff --git a/src/platform/wii/menu.h b/src/platform/wii/menu.h new file mode 100644 index 0000000..36a099c --- /dev/null +++ b/src/platform/wii/menu.h @@ -0,0 +1,26 @@ +#ifndef _MENUH_ +#define _MENUH_ + +extern int MENU_CyclesDisplay; +extern int MENU_FrameskipDisplay; + + +/** + * Increase or decrease the current CPU cycles. + * + * Implemented in src/cpu/cpu.cpp + * + * @param increase True for increase cycles. False for decrease cycles. + */ +void MENU_CycleIncreaseOrDecrease(bool increase); + +/** + * Increase or decrease the current frameskip + * + * Implemented in src/gui/render.cpp + * + * @param increase True for increase cycles. False for decrease cycles. + */ +void MENU_IncreaseOrDecreaseFrameSkip(bool increase); + +#endif