(Xbox 1) Freed up some more memory (32MB to 36MB free in VBA Next)

This commit is contained in:
twinaphex 2012-07-24 17:45:28 +02:00
parent 2240e96b20
commit a82d0c7a9e
7 changed files with 6 additions and 96 deletions

View File

@ -38,10 +38,7 @@ bool Font::Create()
if (m_pFont)
m_pFont->Release();
word *wcPathBuf = StringToWChar("D:\\Media\\arial.ttf");
HRESULT g_hResult = XFONT_OpenTrueTypeFont(wcPathBuf, 256 * 1024, &m_pFont);
delete [] wcPathBuf;
HRESULT g_hResult = XFONT_OpenTrueTypeFont(L"D:\\Media\\arial.ttf", 256 * 1024, &m_pFont);
if (FAILED(g_hResult))
return false;

View File

@ -26,30 +26,10 @@ CMenuMain::CMenuMain()
{
// we think that the rom list is unloaded until we know otherwise
m_bRomListLoadedState = false;
ifstream stateFile;
stateFile.open("T:\\RomlistState.dat");
if (stateFile.is_open())
{
int baseIndex;
stateFile >> baseIndex;
g_romList.m_iBaseIndex = baseIndex;
stateFile.close();
}
}
CMenuMain::~CMenuMain()
{
ofstream stateFile;
stateFile.open("T:\\RomlistState.dat");
stateFile << g_romList.GetBaseIndex() << endl;
stateFile.close();
}
bool CMenuMain::Create()

View File

@ -47,7 +47,7 @@ bool CMenuManager::SetMenuState(int nMenuID)
case MENU_MAIN:
//Create the Main Menu
g_menuMain.Create();
break;
break;
}
return true;
}
@ -60,8 +60,8 @@ void CMenuManager::Update()
{
case MENU_MAIN:
g_menuMain.ProcessInput();
g_menuMain.Render();
break;
g_menuMain.Render();
break;
}
}

View File

@ -36,27 +36,11 @@ bool Rom::Load(const char *szFilename)
return true;
}
bool Rom::LoadFromCache(const string &szFilename)
{
m_szFilename = szFilename;
m_bLoaded = true;
return true;
}
string Rom::GetFileName()
{
return m_szFilename;
}
string Rom::GetComments()
{
//return string(m_iniEntry->szComments);
return "blah";
}
CSurface &Rom::GetTexture()
{
return m_texture;

View File

@ -25,10 +25,8 @@ public:
~Rom();
bool Load(const char *szFilename);
bool LoadFromCache(const string &szFilename);
string GetFileName();
string GetComments();
CSurface &GetTexture();
private:
string m_szFilename;

View File

@ -36,62 +36,14 @@ RomList::~RomList(void)
void RomList::Load()
{
ifstream cacheFile;
cacheFile.open("T:\\RomlistCache.dat");
// try and open the cache file, if it doesnt exist, generate the rom list
if (!cacheFile.is_open())
{
Build();
}
else
{
while (!cacheFile.eof())
{
string szFilename;
getline(cacheFile, szFilename);
Rom *rom = new Rom();
bool bSuccess = rom->LoadFromCache(szFilename);
if (bSuccess)
m_romList.push_back(rom);
else
delete rom;
}
cacheFile.close();
}
Build();
m_bLoaded = true;
}
void RomList::Save()
{
vector<Rom *>::iterator i;
ofstream cacheFile;
// open/overwrite the rom cache
cacheFile.open("T:\\RomlistCache.dat");
for (i = m_romList.begin(); i != m_romList.end(); i++)
{
Rom *rom = *i;
cacheFile << rom->GetFileName() << endl;
}
cacheFile.close();
}
void RomList::Refresh()
{
Destroy();
DeleteFile("T:\\RomlistCache.dat");
DeleteFile("T:\\RomlistState.dat");
}
bool RomList::IsLoaded()

View File

@ -22,10 +22,9 @@ class RomList
{
public:
RomList(void);
virtual ~RomList(void);
~RomList(void);
void Load();
void Save();
void Refresh();
bool IsLoaded();