diff --git a/desmume/src/common.cpp b/desmume/src/common.cpp index 4fa9c127f..56c259bf7 100644 --- a/desmume/src/common.cpp +++ b/desmume/src/common.cpp @@ -22,6 +22,7 @@ */ #include +#include #include "common.h" u8 gba_header_data_0x04[156] = { @@ -107,3 +108,37 @@ u32 strlen_ws(char *buf) // length without last spaces } return 0; } + +std::string RomName = ""; //Stores the name of the Rom currently loaded in memory + +/*** + * Author: adelikat + * Date Added: May 8, 2009 + * Description: Sets the Global variable RomName + * Known Usage: + * LoadRom + **/ +void SetRomName(char *filename) +{ + std::string str = filename; + + //Truncate the path from filename + int x = str.find_last_of("/\\"); + if (x > 0) + str = str.substr(x+1); + RomName = str; +} + +/*** + * Author: adelikat + * Date Added: May 8, 2009 + * Description: Returns the Global variable RomName + * Known Usage: + * included in main.h + * ramwatch.cpp - SaveStrings + **/ + +const char *GetRomName() +{ + return RomName.c_str(); +} \ No newline at end of file diff --git a/desmume/src/common.h b/desmume/src/common.h index e3eb828a1..121e4ca6c 100644 --- a/desmume/src/common.h +++ b/desmume/src/common.h @@ -28,6 +28,9 @@ #include "types.h" extern u8 gba_header_data_0x04[156]; +const char* GetRomName(); //adelikat: return the name of the Rom currently loaded +void SetRomName(char *filename); + #ifdef WIN32 @@ -83,8 +86,5 @@ extern u8 reverseBitsInByte(u8 x); extern void removeCR(char *buf); extern u32 strlen_ws(char *buf); -const char* GetRomName(); //adelikat: return the name of the Rom currently loaded - - #endif diff --git a/desmume/src/movie.cpp b/desmume/src/movie.cpp index 6598569c2..2a7123c92 100644 --- a/desmume/src/movie.cpp +++ b/desmume/src/movie.cpp @@ -29,6 +29,7 @@ #include "readwrite.h" #include "debug.h" #include "rtc.h" +#include "common.h" using namespace std; bool freshMovie = false; //True when a movie loads, false when movie is altered. Used to determine if a movie has been altered since opening diff --git a/desmume/src/windows/main.cpp b/desmume/src/windows/main.cpp index ad5cee2d2..8950cb7da 100644 --- a/desmume/src/windows/main.cpp +++ b/desmume/src/windows/main.cpp @@ -100,11 +100,6 @@ const unsigned int baseid = IDM_RECENT_RESERVED1; //Base identifier for the re static HMENU recentromsmenu; //Handle to the recent ROMs submenu //-------------------------------------- -//----RomName--------------------------- -string RomName = ""; //Stores the name of the Rom currently loaded in memory -void SetRomName(char *filename); -//-------------------------------------- - void UpdateHotkeyAssignments(); //Appends hotkey mappings to corresponding menu items static HMENU mainMenu; //Holds handle to the main DeSmuME menu @@ -4211,34 +4206,3 @@ void UpdateHotkeyAssignments() } -/*** - * Author: adelikat - * Date Added: May 8, 2009 - * Description: Sets the Global variable RomName - * Known Usage: - * LoadRom - **/ -void SetRomName(char *filename) -{ - string str = filename; - - //Truncate the path from filename - int x = str.find_last_of("/\\"); - if (x > 0) - str = str.substr(x+1); - RomName = str; -} - -/*** - * Author: adelikat - * Date Added: May 8, 2009 - * Description: Returns the Global variable RomName - * Known Usage: - * included in main.h - * ramwatch.cpp - SaveStrings - **/ - -const char *GetRomName() -{ - return RomName.c_str(); -} \ No newline at end of file