Skip to content

Commit

Permalink
Merge pull request #44 from Jamiras/p64_checklist
Browse files Browse the repository at this point in the history
Complete checklist for RAProject64
  • Loading branch information
Jamiras authored Mar 6, 2019
2 parents 58e2bc1 + f478688 commit d41c878
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 17 deletions.
10 changes: 10 additions & 0 deletions RAProject64/Source/Project64-core/N64System/N64RomClass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@ bool CN64Rom::AllocateAndLoadN64Image(const char * FileLoc, bool LoadBootCodeOnl
return false;
}

const char* ptr = strrchr(FileLoc, '\\');
if (ptr == NULL)
ptr = FileLoc;
else
++ptr;
strncpy(g_RAGameFileName, ptr, sizeof(g_RAGameFileName));
g_RAGameFileName[sizeof(g_RAGameFileName) - 1] = '\0';

// calculate the hash before byteswapping the ROM.
g_RAGameId = RA_IdentifyRom(m_ROMImage, m_RomFileSize);

Expand Down Expand Up @@ -224,6 +232,8 @@ bool CN64Rom::AllocateAndLoadZipImage(const char * FileLoc, bool LoadBootCodeOnl
}
FoundRom = true;

strncpy(g_RAGameFileName, zname, sizeof(g_RAGameFileName));
g_RAGameFileName[sizeof(g_RAGameFileName) - 1] = '\0';
g_RAGameId = RA_IdentifyRom(m_ROMImage, m_RomFileSize);

g_Notify->DisplayMessage(5, MSG_BYTESWAP);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

#include <Common/Util.h>

#include "../../RA_Integration/src/RA_Interface.h"

// ---------------------------------------------------

const uint32_t CSpeedLimiter::m_DefaultSpeed = 60;
Expand Down Expand Up @@ -99,6 +101,9 @@ void CSpeedLimiter::AlterSpeed( const ESpeedChange SpeedChange )
m_Speed += 1 * SpeedFactor;
}

if (m_Speed < m_DefaultSpeed && RA_HardcoreModeIsActive())
m_Speed = m_DefaultSpeed;

SpeedChanged(m_Speed);
FixSpeedRatio();
}
Expand All @@ -109,7 +114,12 @@ void CSpeedLimiter::SetSpeed(int Speed)
{
Speed = 1;
}
m_Speed = Speed;

if (Speed < m_DefaultSpeed && RA_HardcoreModeIsActive())
m_Speed = m_DefaultSpeed;
else
m_Speed = Speed;

SpeedChanged(m_Speed);
FixSpeedRatio();
}
Expand Down
5 changes: 5 additions & 0 deletions RAProject64/Source/Project64/UserInterface/GuiClass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1167,6 +1167,11 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO
}
}
break;
case WM_CLOSE:
if (!RA_ConfirmLoadNewRom(true))
return 0;
DestroyWindow(hWnd);
break;
case WM_DESTROY:
WriteTrace(TraceUserInterface, TraceDebug, "WM_DESTROY - start");
{
Expand Down
40 changes: 26 additions & 14 deletions RAProject64/Source/Project64/UserInterface/MainMenuClass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ void CMainMenu::OnRomInfo(HWND hWnd)

void CMainMenu::OnEndEmulation(void)
{
if (!RA_ConfirmLoadNewRom(false))
return;

CGuard Guard(m_CS);
WriteTrace(TraceUserInterface, TraceDebug, "ID_FILE_ENDEMULATION");
if (g_BaseSystem)
Expand Down Expand Up @@ -277,7 +280,10 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
WriteTrace(TraceUserInterface, TraceDebug, "ID_FILE_ROMDIRECTORY 3");
break;
case ID_FILE_REFRESHROMLIST: m_Gui->RefreshRomList(); break;
case ID_FILE_EXIT: DestroyWindow((HWND)hWnd); break;
case ID_FILE_EXIT:
if (RA_ConfirmLoadNewRom(true))
DestroyWindow((HWND)hWnd);
break;
case ID_SYSTEM_RESET_SOFT:
WriteTrace(TraceUserInterface, TraceDebug, "ID_SYSTEM_RESET_SOFT");
g_BaseSystem->ExternalEvent(SysEvent_ResetCPU_Soft);
Expand Down Expand Up @@ -358,15 +364,9 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
}
break;
case ID_OPTIONS_INCREASE_SPEED:
if (RA_HardcoreModeIsActive())
break;

g_BaseSystem->AlterSpeed(CSpeedLimiter::INCREASE_SPEED);
break;
case ID_OPTIONS_DECREASE_SPEED:
if (RA_HardcoreModeIsActive())
break;

g_BaseSystem->AlterSpeed(CSpeedLimiter::DECREASE_SPEED);
break;
case ID_OPTIONS_FULLSCREEN:
Expand Down Expand Up @@ -520,10 +520,22 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
case ID_DEBUGGER_GENERATELOG:
g_Settings->SaveBool(Logging_GenerateLog, !g_Settings->LoadBool(Logging_GenerateLog));
break;
case ID_DEBUGGER_DUMPMEMORY: m_Gui->Debug_ShowMemoryDump(); break;
case ID_DEBUGGER_SEARCHMEMORY: m_Gui->Debug_ShowMemorySearch(); break;
case ID_DEBUGGER_MEMORY: m_Gui->Debug_ShowMemoryWindow(); break;
case ID_DEBUGGER_TLBENTRIES: m_Gui->Debug_ShowTLBWindow(); break;
case ID_DEBUGGER_DUMPMEMORY:
if (RA_WarnDisableHardcore("dump memory"))
m_Gui->Debug_ShowMemoryDump();
break;
case ID_DEBUGGER_SEARCHMEMORY:
if (RA_WarnDisableHardcore("search memory"))
m_Gui->Debug_ShowMemorySearch();
break;
case ID_DEBUGGER_MEMORY:
if (RA_WarnDisableHardcore("view memory"))
m_Gui->Debug_ShowMemoryWindow();
break;
case ID_DEBUGGER_TLBENTRIES:
if (RA_WarnDisableHardcore("view TLB entries"))
m_Gui->Debug_ShowTLBWindow();
break;
case ID_DEBUGGER_INTERRUPT_SP: g_BaseSystem->ExternalEvent(SysEvent_Interrupt_SP); break;
case ID_DEBUGGER_INTERRUPT_SI: g_BaseSystem->ExternalEvent(SysEvent_Interrupt_SI); break;
case ID_DEBUGGER_INTERRUPT_AI: g_BaseSystem->ExternalEvent(SysEvent_Interrupt_AI); break;
Expand Down Expand Up @@ -913,9 +925,9 @@ void CMainMenu::FillOutMenu(HMENU hMenu)
}
SystemMenu.push_back(MENU_ITEM(SPLITER));
SystemMenu.push_back(MENU_ITEM(SUB_MENU, MENU_CURRENT_SAVE, EMPTY_STDSTR, &CurrentSaveMenu));
SystemMenu.push_back(MENU_ITEM(SPLITER));
SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_CHEAT, MENU_CHEAT, m_ShortCuts.ShortCutString(ID_SYSTEM_CHEAT, AccessLevel)));
SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_GSBUTTON, MENU_GS_BUTTON, m_ShortCuts.ShortCutString(ID_SYSTEM_GSBUTTON, AccessLevel)));
//SystemMenu.push_back(MENU_ITEM(SPLITER));
//SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_CHEAT, MENU_CHEAT, m_ShortCuts.ShortCutString(ID_SYSTEM_CHEAT, AccessLevel)));
//SystemMenu.push_back(MENU_ITEM(ID_SYSTEM_GSBUTTON, MENU_GS_BUTTON, m_ShortCuts.ShortCutString(ID_SYSTEM_GSBUTTON, AccessLevel)));

/* Option Menu
****************/
Expand Down
9 changes: 7 additions & 2 deletions RAProject64/Source/RA_Implementation/RA_Implementation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

//#include "Project64\UserInterface\Settings\SettingsPage.h"

char g_RAGameFileName[64] = "";

// returns -1 if not found
int GetMenuItemIndex(HMENU hMenu, const char* ItemName)
{
Expand Down Expand Up @@ -67,14 +69,17 @@ void RebuildMenu()
// for the ROM, if one can be inferred from the ROM.
void GetEstimatedGameTitle( char* sNameOut )
{
//if( emu && emu->get_NES_ROM() )
// strcpy_s( sNameOut, 49, emu->get_NES_ROM()->GetRomName() );
strcpy(sNameOut, g_RAGameFileName);
}

void ResetEmulation()
{
if (g_Settings->LoadBool(GameRunning_CPU_Running) || g_Settings->LoadBool(GameRunning_CPU_Paused))
g_BaseSystem->ExternalEvent(SysEvent_ResetCPU_Hard);

// ensure speed is not lower than default
if (RA_HardcoreModeIsActive())
g_BaseSystem->SetSpeed(g_BaseSystem->GetSpeed());
}

void LoadROM( const char* sFullPath )
Expand Down
1 change: 1 addition & 0 deletions RAProject64/Source/RA_Implementation/RA_Implementation.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ extern HWND hMainWindow;
extern HWND hMainWindowStatusBar;
extern unsigned int g_RAGameId;
extern bool doRAThread;
extern char g_RAGameFileName[64];

0 comments on commit d41c878

Please sign in to comment.