(Xbox 1) RetroLaunch - complexity cleanups
This commit is contained in:
parent
53c5ff80ed
commit
2240e96b20
|
@ -34,16 +34,11 @@ Font::~Font(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Font::Create()
|
bool Font::Create()
|
||||||
{ //Hardcoded
|
|
||||||
return Create("D:\\Media\\arial.ttf");
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Font::Create(const string &szTTFFilename)
|
|
||||||
{
|
{
|
||||||
if (m_pFont)
|
if (m_pFont)
|
||||||
m_pFont->Release();
|
m_pFont->Release();
|
||||||
|
|
||||||
word *wcPathBuf = StringToWChar(szTTFFilename);
|
word *wcPathBuf = StringToWChar("D:\\Media\\arial.ttf");
|
||||||
HRESULT g_hResult = XFONT_OpenTrueTypeFont(wcPathBuf, 256 * 1024, &m_pFont);
|
HRESULT g_hResult = XFONT_OpenTrueTypeFont(wcPathBuf, 256 * 1024, &m_pFont);
|
||||||
|
|
||||||
delete [] wcPathBuf;
|
delete [] wcPathBuf;
|
||||||
|
@ -67,14 +62,10 @@ void Font::Render(const string &str, int x, int y, dword height, dword style, D3
|
||||||
delete [] wcBuf;
|
delete [] wcBuf;
|
||||||
|
|
||||||
if (alignment == Center)
|
if (alignment == Center)
|
||||||
{
|
|
||||||
x -= (dwRequiredWidth / 2);
|
x -= (dwRequiredWidth / 2);
|
||||||
}
|
|
||||||
else if (alignment == Right)
|
else if (alignment == Right)
|
||||||
{
|
|
||||||
x -= dwRequiredWidth;
|
x -= dwRequiredWidth;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
texture.Render(x, y);
|
texture.Render(x, y);
|
||||||
}
|
}
|
||||||
|
@ -102,13 +93,10 @@ void Font::RenderToTexture(CSurface &texture, const string &str, dword height, d
|
||||||
// because the textures are swizzled we make sure
|
// because the textures are swizzled we make sure
|
||||||
// the dimensions are a power of two
|
// the dimensions are a power of two
|
||||||
for(dword wmask = 1; dwTextureWidth &(dwTextureWidth - 1); wmask = (wmask << 1 ) + 1)
|
for(dword wmask = 1; dwTextureWidth &(dwTextureWidth - 1); wmask = (wmask << 1 ) + 1)
|
||||||
{
|
|
||||||
dwTextureWidth = (dwTextureWidth + wmask) & ~wmask;
|
dwTextureWidth = (dwTextureWidth + wmask) & ~wmask;
|
||||||
}
|
|
||||||
for(dword hmask = 1; dwTextureHeight &(dwTextureHeight - 1); hmask = (hmask << 1) + 1)
|
for(dword hmask = 1; dwTextureHeight &(dwTextureHeight - 1); hmask = (hmask << 1) + 1)
|
||||||
{
|
|
||||||
dwTextureHeight = ( dwTextureHeight + hmask ) & ~hmask;
|
dwTextureHeight = ( dwTextureHeight + hmask ) & ~hmask;
|
||||||
}
|
|
||||||
|
|
||||||
// also enforce a minimum pitch of 64 bytes
|
// also enforce a minimum pitch of 64 bytes
|
||||||
dwTextureWidth = max(64 / XGBytesPerPixelFromFormat(D3DFMT_A8R8G8B8), dwTextureWidth);
|
dwTextureWidth = max(64 / XGBytesPerPixelFromFormat(D3DFMT_A8R8G8B8), dwTextureWidth);
|
||||||
|
|
|
@ -35,7 +35,6 @@ public:
|
||||||
~Font(void);
|
~Font(void);
|
||||||
|
|
||||||
bool Create();
|
bool Create();
|
||||||
bool Create(const string &szTTFFilename);
|
|
||||||
|
|
||||||
void Render(const string &str, int x, int y, dword height, dword style = XFONT_NORMAL, D3DXCOLOR color = D3DCOLOR_XRGB(0, 0, 0), int dwMaxWidth = -1, bool fade = false, Align alignment = Left);
|
void Render(const string &str, int x, int y, dword height, dword style = XFONT_NORMAL, D3DXCOLOR color = D3DCOLOR_XRGB(0, 0, 0), int dwMaxWidth = -1, bool fade = false, Align alignment = Left);
|
||||||
void RenderToTexture(CSurface &texture, const string &str, dword height, dword style = XFONT_NORMAL, D3DXCOLOR color = D3DCOLOR_XRGB(0, 0, 0), int maxWidth = -1, bool fade = false);
|
void RenderToTexture(CSurface &texture, const string &str, dword height, dword style = XFONT_NORMAL, D3DXCOLOR color = D3DCOLOR_XRGB(0, 0, 0), int maxWidth = -1, bool fade = false);
|
||||||
|
@ -44,7 +43,6 @@ public:
|
||||||
int GetRequiredHeight(const string &str, dword height, dword style);
|
int GetRequiredHeight(const string &str, dword height, dword style);
|
||||||
|
|
||||||
word *StringToWChar(const string &str);
|
word *StringToWChar(const string &str);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
XFONT *m_pFont;
|
XFONT *m_pFont;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// IoSupport.cpp: implementation of the CIoSupport class.
|
// IoSupport.cpp: implementation of the CIoSupport class.
|
||||||
//
|
//
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
#ifdef _XBOX
|
|
||||||
#include "iosupport.h"
|
#include "iosupport.h"
|
||||||
#include "undocumented.h"
|
#include "undocumented.h"
|
||||||
|
|
||||||
|
@ -189,73 +188,3 @@ HRESULT CIoSupport::Shutdown()
|
||||||
HalInitiateShutdown();
|
HalInitiateShutdown();
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
HANDLE CIoSupport::CreateFile()
|
|
||||||
{
|
|
||||||
ANSI_STRING filename;
|
|
||||||
OBJECT_ATTRIBUTES attributes;
|
|
||||||
IO_STATUS_BLOCK status;
|
|
||||||
HANDLE hDevice;
|
|
||||||
NTSTATUS error;
|
|
||||||
|
|
||||||
RtlInitAnsiString(&filename, "\\Device\\Cdrom0");
|
|
||||||
InitializeObjectAttributes(&attributes, &filename, OBJ_CASE_INSENSITIVE, NULL);
|
|
||||||
|
|
||||||
if (!NT_SUCCESS(error = NtCreateFile(&hDevice, GENERIC_READ |
|
|
||||||
SYNCHRONIZE | FILE_READ_ATTRIBUTES, &attributes, &status, NULL, 0,
|
|
||||||
FILE_SHARE_READ, FILE_OPEN, FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT)))
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return hDevice;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL CIoSupport::GetFirstFile(CHAR* szFilename)
|
|
||||||
{
|
|
||||||
ANSI_STRING filename;
|
|
||||||
OBJECT_ATTRIBUTES attributes;
|
|
||||||
IO_STATUS_BLOCK status;
|
|
||||||
HANDLE hDevice;
|
|
||||||
NTSTATUS error;
|
|
||||||
|
|
||||||
RtlInitAnsiString(&filename, "\\Device\\Cdrom0");
|
|
||||||
InitializeObjectAttributes(&attributes, &filename, OBJ_CASE_INSENSITIVE, NULL);
|
|
||||||
|
|
||||||
if (!NT_SUCCESS(error = NtCreateFile(&hDevice, GENERIC_READ |
|
|
||||||
SYNCHRONIZE | FILE_READ_ATTRIBUTES, &attributes, &status, NULL, 0,
|
|
||||||
FILE_SHARE_READ, FILE_OPEN, FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT)))
|
|
||||||
{
|
|
||||||
OutputDebugString("Unable to open Cdrom0.\n");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
CHAR* szBuffer = new CHAR[2048];
|
|
||||||
DWORD dwRead = 0;
|
|
||||||
|
|
||||||
SetFilePointer(hDevice, 19 * 2048, NULL, FILE_BEGIN);
|
|
||||||
if (!ReadFile(hDevice, szBuffer, 2048, &dwRead, NULL))
|
|
||||||
{
|
|
||||||
OutputDebugString("Unable to read ISO9660 root directory.\n");
|
|
||||||
CloseHandle(hDevice);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
CloseHandle(hDevice);
|
|
||||||
szBuffer[2047] = 0;
|
|
||||||
|
|
||||||
int offset = 0;
|
|
||||||
while (szBuffer[offset] == 0x22) offset += 0x22;
|
|
||||||
offset += 33; // jump to start of filename
|
|
||||||
|
|
||||||
strcpy(szFilename, "#");
|
|
||||||
strcat(szFilename, &szBuffer[offset]);
|
|
||||||
|
|
||||||
if (szBuffer)
|
|
||||||
delete [] szBuffer;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -38,10 +38,6 @@ public:
|
||||||
HRESULT EjectTray();
|
HRESULT EjectTray();
|
||||||
HRESULT CloseTray();
|
HRESULT CloseTray();
|
||||||
HRESULT Shutdown();
|
HRESULT Shutdown();
|
||||||
|
|
||||||
HANDLE CreateFile();
|
|
||||||
BOOL GetFirstFile(CHAR* szFilename);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DWORD m_dwTrayState;
|
DWORD m_dwTrayState;
|
||||||
DWORD m_dwTrayCount;
|
DWORD m_dwTrayCount;
|
||||||
|
|
|
@ -33,21 +33,13 @@ CMenuMain::CMenuMain()
|
||||||
if (stateFile.is_open())
|
if (stateFile.is_open())
|
||||||
{
|
{
|
||||||
int baseIndex;
|
int baseIndex;
|
||||||
int romListMode;
|
|
||||||
|
|
||||||
stateFile >> baseIndex;
|
stateFile >> baseIndex;
|
||||||
stateFile >> romListMode;
|
|
||||||
stateFile >> m_displayMode;
|
|
||||||
|
|
||||||
g_romList.SetRomListMode(romListMode);
|
|
||||||
g_romList.m_iBaseIndex = baseIndex;
|
g_romList.m_iBaseIndex = baseIndex;
|
||||||
|
|
||||||
stateFile.close();
|
stateFile.close();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
m_displayMode = List;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CMenuMain::~CMenuMain()
|
CMenuMain::~CMenuMain()
|
||||||
|
@ -56,8 +48,6 @@ CMenuMain::~CMenuMain()
|
||||||
stateFile.open("T:\\RomlistState.dat");
|
stateFile.open("T:\\RomlistState.dat");
|
||||||
|
|
||||||
stateFile << g_romList.GetBaseIndex() << endl;
|
stateFile << g_romList.GetBaseIndex() << endl;
|
||||||
stateFile << g_romList.GetRomListMode() << endl;
|
|
||||||
stateFile << m_displayMode << endl;
|
|
||||||
|
|
||||||
stateFile.close();
|
stateFile.close();
|
||||||
}
|
}
|
||||||
|
@ -102,9 +92,7 @@ bool CMenuMain::Create()
|
||||||
m_romListOffset = 0;
|
m_romListOffset = 0;
|
||||||
|
|
||||||
if(m_romListEndRender > g_romList.GetRomListSize() - 1)
|
if(m_romListEndRender > g_romList.GetRomListSize() - 1)
|
||||||
{
|
|
||||||
m_romListEndRender = g_romList.GetRomListSize() - 1;
|
m_romListEndRender = g_romList.GetRomListSize() - 1;
|
||||||
}
|
|
||||||
|
|
||||||
//Generate the rom list textures only once
|
//Generate the rom list textures only once
|
||||||
vector<Rom *>::iterator i;
|
vector<Rom *>::iterator i;
|
||||||
|
@ -121,8 +109,6 @@ bool CMenuMain::Create()
|
||||||
|
|
||||||
void CMenuMain::Render()
|
void CMenuMain::Render()
|
||||||
{
|
{
|
||||||
//CheckRomListState();
|
|
||||||
|
|
||||||
//Render background image
|
//Render background image
|
||||||
m_menuMainBG.Render(m_menuMainBG_x, m_menuMainBG_y);
|
m_menuMainBG.Render(m_menuMainBG_x, m_menuMainBG_y);
|
||||||
|
|
||||||
|
@ -161,7 +147,6 @@ void CMenuMain::ProcessInput()
|
||||||
{
|
{
|
||||||
if(m_romListSelectedRom < g_romList.GetRomListSize())
|
if(m_romListSelectedRom < g_romList.GetRomListSize())
|
||||||
{
|
{
|
||||||
|
|
||||||
if(m_menuMainRomSelectPanel_y < (m_menuMainRomListPos_y + (m_menuMainRomListSpacing * m_romListEndRender)))
|
if(m_menuMainRomSelectPanel_y < (m_menuMainRomListPos_y + (m_menuMainRomListSpacing * m_romListEndRender)))
|
||||||
{
|
{
|
||||||
m_menuMainRomSelectPanel_y += m_menuMainRomListSpacing;
|
m_menuMainRomSelectPanel_y += m_menuMainRomListSpacing;
|
||||||
|
@ -174,14 +159,12 @@ void CMenuMain::ProcessInput()
|
||||||
m_menuMainRomSelectPanel_y -= m_menuMainRomListSpacing;
|
m_menuMainRomSelectPanel_y -= m_menuMainRomListSpacing;
|
||||||
m_romListSelectedRom++;
|
m_romListSelectedRom++;
|
||||||
if(m_romListSelectedRom > g_romList.GetRomListSize() - 1)
|
if(m_romListSelectedRom > g_romList.GetRomListSize() - 1)
|
||||||
{
|
|
||||||
m_romListSelectedRom = g_romList.GetRomListSize() - 1;
|
m_romListSelectedRom = g_romList.GetRomListSize() - 1;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
RARCH_LOG("SELECTED ROM AFTER CORRECTION: %d.\n", m_romListSelectedRom);
|
RARCH_LOG("SELECTED ROM AFTER CORRECTION: %d.\n", m_romListSelectedRom);
|
||||||
|
|
||||||
if(m_romListSelectedRom < g_romList.GetRomListSize() - 1 && m_romListOffset < g_romList.GetRomListSize() - 1 - m_romListEndRender - 1) {
|
if(m_romListSelectedRom < g_romList.GetRomListSize() - 1 && m_romListOffset < g_romList.GetRomListSize() - 1 - m_romListEndRender - 1)
|
||||||
|
{
|
||||||
m_romListOffset++;
|
m_romListOffset++;
|
||||||
RARCH_LOG("OFFSET: %d.\n", m_romListOffset);
|
RARCH_LOG("OFFSET: %d.\n", m_romListOffset);
|
||||||
}
|
}
|
||||||
|
@ -205,14 +188,12 @@ void CMenuMain::ProcessInput()
|
||||||
m_menuMainRomSelectPanel_y += m_menuMainRomListSpacing;
|
m_menuMainRomSelectPanel_y += m_menuMainRomListSpacing;
|
||||||
m_romListSelectedRom--;
|
m_romListSelectedRom--;
|
||||||
if(m_romListSelectedRom < 0)
|
if(m_romListSelectedRom < 0)
|
||||||
{
|
|
||||||
m_romListSelectedRom = 0;
|
m_romListSelectedRom = 0;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
RARCH_LOG("SELECTED ROM AFTER CORRECTION: %d.\n", m_romListSelectedRom);
|
RARCH_LOG("SELECTED ROM AFTER CORRECTION: %d.\n", m_romListSelectedRom);
|
||||||
|
|
||||||
if(m_romListSelectedRom > 0 && m_romListOffset > 0) {
|
if(m_romListSelectedRom > 0 && m_romListOffset > 0)
|
||||||
|
{
|
||||||
m_romListOffset--;
|
m_romListOffset--;
|
||||||
RARCH_LOG("OFFSET: %d.\n", m_romListOffset);
|
RARCH_LOG("OFFSET: %d.\n", m_romListOffset);
|
||||||
}
|
}
|
||||||
|
@ -222,9 +203,7 @@ void CMenuMain::ProcessInput()
|
||||||
|
|
||||||
// Press A to launch, selected rom filename is saved into T:\\tmp.retro
|
// Press A to launch, selected rom filename is saved into T:\\tmp.retro
|
||||||
if (trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_B) || trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_START))
|
if (trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_B) || trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_START))
|
||||||
{
|
|
||||||
rarch_console_load_game(g_romList.GetRomAt(m_romListSelectedRom)->GetFileName().c_str());
|
rarch_console_load_game(g_romList.GetRomAt(m_romListSelectedRom)->GetFileName().c_str());
|
||||||
}
|
|
||||||
|
|
||||||
if (trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_R3))
|
if (trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_R3))
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,12 +17,6 @@
|
||||||
#include "Global.h"
|
#include "Global.h"
|
||||||
#include "Surface.h"
|
#include "Surface.h"
|
||||||
|
|
||||||
enum DisplayMode
|
|
||||||
{
|
|
||||||
Box,
|
|
||||||
List
|
|
||||||
};
|
|
||||||
|
|
||||||
class CMenuMain
|
class CMenuMain
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -69,21 +63,6 @@ int m_menuMainRomListPos_x;
|
||||||
int m_menuMainRomListPos_y;
|
int m_menuMainRomListPos_y;
|
||||||
int m_menuMainRomListSpacing;
|
int m_menuMainRomListSpacing;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Rom List menu buttons. The size can be variable so we use a list
|
|
||||||
*/
|
|
||||||
//list<MenuButton *> m_romListButtons;//list<Texture *>
|
|
||||||
//no menu buttons, we will use plain textures
|
|
||||||
list<CSurface *> m_romListButtons;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The current mode the rom list is in
|
|
||||||
*/
|
|
||||||
int m_displayMode;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current loaded state the rom list is in
|
* The current loaded state the rom list is in
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -42,7 +42,8 @@ bool CMenuManager::SetMenuState(int nMenuID)
|
||||||
{
|
{
|
||||||
m_pMenuID = nMenuID;
|
m_pMenuID = nMenuID;
|
||||||
|
|
||||||
switch (m_pMenuID) {
|
switch (m_pMenuID)
|
||||||
|
{
|
||||||
case MENU_MAIN:
|
case MENU_MAIN:
|
||||||
//Create the Main Menu
|
//Create the Main Menu
|
||||||
g_menuMain.Create();
|
g_menuMain.Create();
|
||||||
|
@ -53,20 +54,15 @@ bool CMenuManager::SetMenuState(int nMenuID)
|
||||||
|
|
||||||
void CMenuManager::Update()
|
void CMenuManager::Update()
|
||||||
{
|
{
|
||||||
//Process overall input
|
|
||||||
ProcessInput();
|
ProcessInput();
|
||||||
|
|
||||||
switch (m_pMenuID) {
|
switch (m_pMenuID)
|
||||||
|
{
|
||||||
case MENU_MAIN:
|
case MENU_MAIN:
|
||||||
|
|
||||||
// Process menu specific input
|
|
||||||
g_menuMain.ProcessInput();
|
g_menuMain.ProcessInput();
|
||||||
|
|
||||||
// Render the Main Menu
|
|
||||||
g_menuMain.Render();
|
g_menuMain.Render();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,8 +70,6 @@ void CMenuManager::ProcessInput()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int CMenuManager::GetMenuState()
|
int CMenuManager::GetMenuState()
|
||||||
{
|
{
|
||||||
return m_pMenuID;
|
return m_pMenuID;
|
||||||
|
|
|
@ -27,7 +27,6 @@ enum eMenuState
|
||||||
MENU_LAUNCHER
|
MENU_LAUNCHER
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class CMenuManager
|
class CMenuManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Rom.h"
|
#include "Rom.h"
|
||||||
//#include "BoxArtTable.h"
|
|
||||||
|
|
||||||
Rom::Rom()
|
Rom::Rom()
|
||||||
{
|
{
|
||||||
|
@ -25,28 +24,21 @@ Rom::~Rom(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Rom::Load(const string &szFilename)
|
bool Rom::Load(const char *szFilename)
|
||||||
{
|
{
|
||||||
if (m_bLoaded)
|
if (m_bLoaded)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
m_szFilename = szFilename;
|
m_szFilename = szFilename;
|
||||||
|
|
||||||
// get the filename for the box art image
|
|
||||||
//FIXME: Add BoxArtTable.cpp/h, open iso file, grab header, extract ID ie. T-6003G, use for boxartfilename
|
|
||||||
{
|
|
||||||
m_szBoxArtFilename = "D:\\boxart\\default.jpg"; //g_boxArtTable.GetBoxArtFilename(m_dwCrc1);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_bLoaded = true;
|
m_bLoaded = true;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Rom::LoadFromCache(const string &szFilename, const string &szBoxArtFilename)
|
bool Rom::LoadFromCache(const string &szFilename)
|
||||||
{
|
{
|
||||||
m_szFilename = szFilename;
|
m_szFilename = szFilename;
|
||||||
m_szBoxArtFilename = szBoxArtFilename;
|
|
||||||
|
|
||||||
m_bLoaded = true;
|
m_bLoaded = true;
|
||||||
|
|
||||||
|
@ -58,11 +50,6 @@ string Rom::GetFileName()
|
||||||
return m_szFilename;
|
return m_szFilename;
|
||||||
}
|
}
|
||||||
|
|
||||||
string Rom::GetBoxArtFilename()
|
|
||||||
{
|
|
||||||
return m_szBoxArtFilename;
|
|
||||||
}
|
|
||||||
|
|
||||||
string Rom::GetComments()
|
string Rom::GetComments()
|
||||||
{
|
{
|
||||||
//return string(m_iniEntry->szComments);
|
//return string(m_iniEntry->szComments);
|
||||||
|
|
|
@ -24,20 +24,14 @@ public:
|
||||||
Rom();
|
Rom();
|
||||||
~Rom();
|
~Rom();
|
||||||
|
|
||||||
bool Load(const string &szFilename);
|
bool Load(const char *szFilename);
|
||||||
bool LoadFromCache(const string &szFilename, const string &szBoxArtFilename);
|
bool LoadFromCache(const string &szFilename);
|
||||||
|
|
||||||
string GetFileName();
|
string GetFileName();
|
||||||
string GetBoxArtFilename();
|
|
||||||
string GetComments();
|
string GetComments();
|
||||||
|
|
||||||
CSurface &GetTexture();
|
CSurface &GetTexture();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
string m_szFilename;
|
string m_szFilename;
|
||||||
string m_szBoxArtFilename;
|
|
||||||
|
|
||||||
bool m_bLoaded;
|
bool m_bLoaded;
|
||||||
|
|
||||||
CSurface m_texture;
|
CSurface m_texture;
|
||||||
};
|
};
|
||||||
|
|
|
@ -24,7 +24,6 @@ bool RLessThan(Rom *elem1, Rom *elem2)
|
||||||
|
|
||||||
RomList::RomList(void)
|
RomList::RomList(void)
|
||||||
{
|
{
|
||||||
m_romListMode = All;
|
|
||||||
m_iBaseIndex = 0;
|
m_iBaseIndex = 0;
|
||||||
m_bLoaded = false;
|
m_bLoaded = false;
|
||||||
m_szRomPath = "D:\\";
|
m_szRomPath = "D:\\";
|
||||||
|
@ -51,14 +50,12 @@ void RomList::Load()
|
||||||
while (!cacheFile.eof())
|
while (!cacheFile.eof())
|
||||||
{
|
{
|
||||||
string szFilename;
|
string szFilename;
|
||||||
string szBoxArtFilename;
|
|
||||||
|
|
||||||
getline(cacheFile, szFilename);
|
getline(cacheFile, szFilename);
|
||||||
getline(cacheFile, szBoxArtFilename);
|
|
||||||
|
|
||||||
Rom *rom = new Rom();
|
Rom *rom = new Rom();
|
||||||
|
|
||||||
bool bSuccess = rom->LoadFromCache(szFilename, szBoxArtFilename);
|
bool bSuccess = rom->LoadFromCache(szFilename);
|
||||||
|
|
||||||
if (bSuccess)
|
if (bSuccess)
|
||||||
m_romList.push_back(rom);
|
m_romList.push_back(rom);
|
||||||
|
@ -85,7 +82,6 @@ void RomList::Save()
|
||||||
Rom *rom = *i;
|
Rom *rom = *i;
|
||||||
|
|
||||||
cacheFile << rom->GetFileName() << endl;
|
cacheFile << rom->GetFileName() << endl;
|
||||||
cacheFile << rom->GetBoxArtFilename() << endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cacheFile.close();
|
cacheFile.close();
|
||||||
|
@ -103,29 +99,11 @@ bool RomList::IsLoaded()
|
||||||
return m_bLoaded;
|
return m_bLoaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RomList::SetRomListMode(int mode)
|
|
||||||
{
|
|
||||||
m_iBaseIndex = 0;
|
|
||||||
m_romListMode = mode;
|
|
||||||
}
|
|
||||||
|
|
||||||
int RomList::GetRomListMode()
|
|
||||||
{
|
|
||||||
return m_romListMode;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RomList::AddRomToList(Rom *rom, int mode)
|
void RomList::AddRomToList(Rom *rom, int mode)
|
||||||
{
|
{
|
||||||
vector<Rom *> *pList;
|
vector<Rom *> *pList;
|
||||||
|
|
||||||
switch (mode)
|
|
||||||
{
|
|
||||||
case All:
|
|
||||||
pList = &m_romList;
|
pList = &m_romList;
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// look to see if the rom is already in the list, we dont want duplicates
|
// look to see if the rom is already in the list, we dont want duplicates
|
||||||
for (int i = 0; i < static_cast<int>(pList->size()); i++)
|
for (int i = 0; i < static_cast<int>(pList->size()); i++)
|
||||||
|
@ -142,14 +120,7 @@ void RomList::RemoveRomFromList(Rom *rom, int mode)
|
||||||
{
|
{
|
||||||
vector<Rom *> *pList;
|
vector<Rom *> *pList;
|
||||||
|
|
||||||
switch (mode)
|
|
||||||
{
|
|
||||||
case All:
|
|
||||||
pList = &m_romList;
|
pList = &m_romList;
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
vector<Rom *>::iterator i;
|
vector<Rom *>::iterator i;
|
||||||
|
|
||||||
|
@ -186,38 +157,19 @@ void RomList::SetBaseIndex(int index)
|
||||||
|
|
||||||
int RomList::GetRomListSize()
|
int RomList::GetRomListSize()
|
||||||
{
|
{
|
||||||
switch (m_romListMode)
|
|
||||||
{
|
|
||||||
case All:
|
|
||||||
return m_romList.size();
|
return m_romList.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
Rom *RomList::GetRomAt(int index)
|
Rom *RomList::GetRomAt(int index)
|
||||||
{
|
{
|
||||||
switch (m_romListMode)
|
|
||||||
{
|
|
||||||
case All:
|
|
||||||
return m_romList[index];
|
return m_romList[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int RomList::FindRom(Rom *rom, int mode)
|
int RomList::FindRom(Rom *rom, int mode)
|
||||||
{
|
{
|
||||||
vector<Rom *> *pList;
|
vector<Rom *> *pList;
|
||||||
|
|
||||||
switch (mode)
|
|
||||||
{
|
|
||||||
case All:
|
|
||||||
pList = &m_romList;
|
pList = &m_romList;
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < static_cast<int>(pList->size()); i++)
|
for (int i = 0; i < static_cast<int>(pList->size()); i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,11 +18,6 @@
|
||||||
#include "Global.h"
|
#include "Global.h"
|
||||||
#include "Rom.h"
|
#include "Rom.h"
|
||||||
|
|
||||||
enum RomListMode
|
|
||||||
{
|
|
||||||
All
|
|
||||||
};
|
|
||||||
|
|
||||||
class RomList
|
class RomList
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -35,9 +30,6 @@ public:
|
||||||
|
|
||||||
bool IsLoaded();
|
bool IsLoaded();
|
||||||
|
|
||||||
void SetRomListMode(int mode);
|
|
||||||
int GetRomListMode();
|
|
||||||
|
|
||||||
void AddRomToList(Rom *rom, int mode);
|
void AddRomToList(Rom *rom, int mode);
|
||||||
void RemoveRomFromList(Rom *rom, int mode);
|
void RemoveRomFromList(Rom *rom, int mode);
|
||||||
|
|
||||||
|
@ -61,11 +53,7 @@ private:
|
||||||
void Destroy();
|
void Destroy();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
bool m_bLoaded;
|
bool m_bLoaded;
|
||||||
|
|
||||||
int m_romListMode;
|
|
||||||
|
|
||||||
string m_szRomPath;
|
string m_szRomPath;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -215,13 +215,6 @@ void CSurface::SetOpacity(byte opacity)
|
||||||
m_byOpacity = opacity;
|
m_byOpacity = opacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSurface::SetTint(byte r, byte g, byte b)
|
|
||||||
{
|
|
||||||
m_byR = r;
|
|
||||||
m_byG = g;
|
|
||||||
m_byB = b;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSurface::MoveTo(int x, int y)
|
void CSurface::MoveTo(int x, int y)
|
||||||
{
|
{
|
||||||
m_x = x;
|
m_x = x;
|
||||||
|
|
|
@ -43,7 +43,6 @@ public:
|
||||||
* Set functions
|
* Set functions
|
||||||
*/
|
*/
|
||||||
void SetOpacity(byte opacity);
|
void SetOpacity(byte opacity);
|
||||||
void SetTint(byte r, byte g, byte b);
|
|
||||||
|
|
||||||
void MoveTo(int x, int y);
|
void MoveTo(int x, int y);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue