make it a menu option while we're at it

This commit is contained in:
StapleButter 2017-09-21 04:08:03 +02:00
parent 495d0ba12d
commit 48cf9eb805
4 changed files with 20 additions and 0 deletions

View File

@ -151,6 +151,11 @@ void Reset()
GPU2D_B->SetFramebuffer(&Framebuffer[256*0]);
}
void Stop()
{
memset(Framebuffer, 0, 256*192*2*4);
}
// VRAM mapping notes
//

View File

@ -70,6 +70,7 @@ extern GPU2D* GPU2D_B;
bool Init();
void DeInit();
void Reset();
void Stop();
void MapVRAM_AB(u32 bank, u8 cnt);
void MapVRAM_CD(u32 bank, u8 cnt);

View File

@ -347,6 +347,7 @@ void Stop()
{
printf("Stopping: shutdown\n");
Platform::StopEmu();
GPU::Stop();
SPU::Stop();
}

View File

@ -37,6 +37,7 @@ uiArea* MainDrawArea;
uiMenuItem* MenuItem_Pause;
uiMenuItem* MenuItem_Reset;
uiMenuItem* MenuItem_Stop;
SDL_Thread* EmuThread;
int EmuRunning;
@ -261,6 +262,7 @@ void Run()
uiMenuItemEnable(MenuItem_Pause);
uiMenuItemEnable(MenuItem_Reset);
uiMenuItemEnable(MenuItem_Stop);
uiMenuItemSetChecked(MenuItem_Pause, 0);
}
@ -271,6 +273,7 @@ void Stop()
uiMenuItemDisable(MenuItem_Pause);
uiMenuItemDisable(MenuItem_Reset);
uiMenuItemDisable(MenuItem_Stop);
uiMenuItemSetChecked(MenuItem_Pause, 0);
memset(ScreenBuffer, 256*384*4, 0);
@ -355,6 +358,13 @@ void OnReset(uiMenuItem* item, uiWindow* window, void* blarg)
Run();
}
void OnStop(uiMenuItem* item, uiWindow* window, void* blarg)
{
if (!RunningSomething) return;
Stop();
}
int main(int argc, char** argv)
{
@ -404,6 +414,9 @@ int main(int argc, char** argv)
menuitem = uiMenuAppendItem(menu, "Reset");
uiMenuItemOnClicked(menuitem, OnReset, NULL);
MenuItem_Reset = menuitem;
menuitem = uiMenuAppendItem(menu, "Stop");
uiMenuItemOnClicked(menuitem, OnStop, NULL);
MenuItem_Stop = menuitem;
MainWindow = uiNewWindow("melonDS " MELONDS_VERSION, 256, 384, 1);
uiWindowOnClosing(MainWindow, OnCloseWindow, NULL);