mirror of
https://github.com/libretro/RetroArch
synced 2025-02-21 00:40:09 +00:00
(Xbox 1) RetroLaunch - complexity cleanups
This commit is contained in:
parent
53c5ff80ed
commit
2240e96b20
@ -34,16 +34,11 @@ Font::~Font(void)
|
||||
}
|
||||
|
||||
bool Font::Create()
|
||||
{ //Hardcoded
|
||||
return Create("D:\\Media\\arial.ttf");
|
||||
}
|
||||
|
||||
bool Font::Create(const string &szTTFFilename)
|
||||
{
|
||||
if (m_pFont)
|
||||
m_pFont->Release();
|
||||
|
||||
word *wcPathBuf = StringToWChar(szTTFFilename);
|
||||
word *wcPathBuf = StringToWChar("D:\\Media\\arial.ttf");
|
||||
HRESULT g_hResult = XFONT_OpenTrueTypeFont(wcPathBuf, 256 * 1024, &m_pFont);
|
||||
|
||||
delete [] wcPathBuf;
|
||||
@ -67,13 +62,9 @@ void Font::Render(const string &str, int x, int y, dword height, dword style, D3
|
||||
delete [] wcBuf;
|
||||
|
||||
if (alignment == Center)
|
||||
{
|
||||
x -= (dwRequiredWidth / 2);
|
||||
}
|
||||
else if (alignment == Right)
|
||||
{
|
||||
x -= dwRequiredWidth;
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
// the dimensions are a power of two
|
||||
for(dword wmask = 1; dwTextureWidth &(dwTextureWidth - 1); wmask = (wmask << 1 ) + 1)
|
||||
{
|
||||
dwTextureWidth = (dwTextureWidth + wmask) & ~wmask;
|
||||
}
|
||||
|
||||
for(dword hmask = 1; dwTextureHeight &(dwTextureHeight - 1); hmask = (hmask << 1) + 1)
|
||||
{
|
||||
dwTextureHeight = ( dwTextureHeight + hmask ) & ~hmask;
|
||||
}
|
||||
|
||||
// also enforce a minimum pitch of 64 bytes
|
||||
dwTextureWidth = max(64 / XGBytesPerPixelFromFormat(D3DFMT_A8R8G8B8), dwTextureWidth);
|
||||
@ -228,4 +216,4 @@ word *Font::StringToWChar(const string &str)
|
||||
|
||||
return retVal;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
@ -35,7 +35,6 @@ public:
|
||||
~Font(void);
|
||||
|
||||
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 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,10 +43,9 @@ public:
|
||||
int GetRequiredHeight(const string &str, dword height, dword style);
|
||||
|
||||
word *StringToWChar(const string &str);
|
||||
|
||||
private:
|
||||
XFONT *m_pFont;
|
||||
};
|
||||
|
||||
extern Font g_font;
|
||||
#endif
|
||||
#endif
|
||||
|
@ -1,7 +1,6 @@
|
||||
// IoSupport.cpp: implementation of the CIoSupport class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
#ifdef _XBOX
|
||||
#include "iosupport.h"
|
||||
#include "undocumented.h"
|
||||
|
||||
@ -188,74 +187,4 @@ HRESULT CIoSupport::Shutdown()
|
||||
{
|
||||
HalInitiateShutdown();
|
||||
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 CloseTray();
|
||||
HRESULT Shutdown();
|
||||
|
||||
HANDLE CreateFile();
|
||||
BOOL GetFirstFile(CHAR* szFilename);
|
||||
|
||||
private:
|
||||
DWORD m_dwTrayState;
|
||||
DWORD m_dwTrayCount;
|
||||
|
@ -24,122 +24,108 @@ CMenuMain g_menuMain;
|
||||
|
||||
CMenuMain::CMenuMain()
|
||||
{
|
||||
// we think that the rom list is unloaded until we know otherwise
|
||||
m_bRomListLoadedState = false;
|
||||
// we think that the rom list is unloaded until we know otherwise
|
||||
m_bRomListLoadedState = false;
|
||||
|
||||
ifstream stateFile;
|
||||
stateFile.open("T:\\RomlistState.dat");
|
||||
ifstream stateFile;
|
||||
stateFile.open("T:\\RomlistState.dat");
|
||||
|
||||
if (stateFile.is_open())
|
||||
{
|
||||
int baseIndex;
|
||||
int romListMode;
|
||||
if (stateFile.is_open())
|
||||
{
|
||||
int baseIndex;
|
||||
|
||||
stateFile >> baseIndex;
|
||||
stateFile >> romListMode;
|
||||
stateFile >> m_displayMode;
|
||||
stateFile >> baseIndex;
|
||||
|
||||
g_romList.SetRomListMode(romListMode);
|
||||
g_romList.m_iBaseIndex = baseIndex;
|
||||
g_romList.m_iBaseIndex = baseIndex;
|
||||
|
||||
stateFile.close();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_displayMode = List;
|
||||
}
|
||||
stateFile.close();
|
||||
}
|
||||
}
|
||||
|
||||
CMenuMain::~CMenuMain()
|
||||
{
|
||||
ofstream stateFile;
|
||||
stateFile.open("T:\\RomlistState.dat");
|
||||
ofstream stateFile;
|
||||
stateFile.open("T:\\RomlistState.dat");
|
||||
|
||||
stateFile << g_romList.GetBaseIndex() << endl;
|
||||
stateFile << g_romList.GetRomListMode() << endl;
|
||||
stateFile << m_displayMode << endl;
|
||||
stateFile << g_romList.GetBaseIndex() << endl;
|
||||
|
||||
stateFile.close();
|
||||
stateFile.close();
|
||||
}
|
||||
|
||||
bool CMenuMain::Create()
|
||||
{
|
||||
RARCH_LOG("CMenuMain::Create().");
|
||||
RARCH_LOG("CMenuMain::Create().");
|
||||
|
||||
// Title coords with color
|
||||
m_menuMainTitle_x = 305;
|
||||
m_menuMainTitle_y = 30;
|
||||
m_menuMainTitle_c = 0xFFFFFFFF;
|
||||
// Title coords with color
|
||||
m_menuMainTitle_x = 305;
|
||||
m_menuMainTitle_y = 30;
|
||||
m_menuMainTitle_c = 0xFFFFFFFF;
|
||||
|
||||
// Load background image
|
||||
m_menuMainBG.Create("Media\\menuMainBG.png");
|
||||
m_menuMainBG_x = 0;
|
||||
m_menuMainBG_y = 0;
|
||||
m_menuMainBG_w = 640;
|
||||
m_menuMainBG_h = 480;
|
||||
// Load background image
|
||||
m_menuMainBG.Create("Media\\menuMainBG.png");
|
||||
m_menuMainBG_x = 0;
|
||||
m_menuMainBG_y = 0;
|
||||
m_menuMainBG_w = 640;
|
||||
m_menuMainBG_h = 480;
|
||||
|
||||
// Init rom list coords
|
||||
m_menuMainRomListPos_x = 100;
|
||||
m_menuMainRomListPos_y = 100;
|
||||
m_menuMainRomListSpacing = 20;
|
||||
// Init rom list coords
|
||||
m_menuMainRomListPos_x = 100;
|
||||
m_menuMainRomListPos_y = 100;
|
||||
m_menuMainRomListSpacing = 20;
|
||||
|
||||
// Load rom selector panel
|
||||
m_menuMainRomSelectPanel.Create("Media\\menuMainRomSelectPanel.png");
|
||||
m_menuMainRomSelectPanel_x = m_menuMainRomListPos_x - 5;
|
||||
m_menuMainRomSelectPanel_y = m_menuMainRomListPos_y - 2;
|
||||
m_menuMainRomSelectPanel_w = 440;
|
||||
m_menuMainRomSelectPanel_h = 20;
|
||||
// Load rom selector panel
|
||||
m_menuMainRomSelectPanel.Create("Media\\menuMainRomSelectPanel.png");
|
||||
m_menuMainRomSelectPanel_x = m_menuMainRomListPos_x - 5;
|
||||
m_menuMainRomSelectPanel_y = m_menuMainRomListPos_y - 2;
|
||||
m_menuMainRomSelectPanel_w = 440;
|
||||
m_menuMainRomSelectPanel_h = 20;
|
||||
|
||||
m_romListSelectedRom = 0;
|
||||
m_romListSelectedRom = 0;
|
||||
|
||||
//The first element in the romlist to render
|
||||
m_romListBeginRender = 0;
|
||||
//The first element in the romlist to render
|
||||
m_romListBeginRender = 0;
|
||||
|
||||
//The last element in the romlist to render
|
||||
m_romListEndRender = 18;
|
||||
//The last element in the romlist to render
|
||||
m_romListEndRender = 18;
|
||||
|
||||
//The offset in the romlist
|
||||
m_romListOffset = 0;
|
||||
//The offset in the romlist
|
||||
m_romListOffset = 0;
|
||||
|
||||
if(m_romListEndRender > g_romList.GetRomListSize() - 1)
|
||||
{
|
||||
m_romListEndRender = g_romList.GetRomListSize() - 1;
|
||||
}
|
||||
if(m_romListEndRender > g_romList.GetRomListSize() - 1)
|
||||
m_romListEndRender = g_romList.GetRomListSize() - 1;
|
||||
|
||||
//Generate the rom list textures only once
|
||||
vector<Rom *>::iterator i;
|
||||
dword y = 0;
|
||||
for (i = g_romList.m_romList.begin(); i != g_romList.m_romList.end(); i++)
|
||||
{
|
||||
Rom *rom = *i;
|
||||
g_font.RenderToTexture(rom->GetTexture(), rom->GetFileName(), 18, XFONT_BOLD, 0xff808080, -1, false);
|
||||
}
|
||||
//Generate the rom list textures only once
|
||||
vector<Rom *>::iterator i;
|
||||
dword y = 0;
|
||||
for (i = g_romList.m_romList.begin(); i != g_romList.m_romList.end(); i++)
|
||||
{
|
||||
Rom *rom = *i;
|
||||
g_font.RenderToTexture(rom->GetTexture(), rom->GetFileName(), 18, XFONT_BOLD, 0xff808080, -1, false);
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void CMenuMain::Render()
|
||||
{
|
||||
//CheckRomListState();
|
||||
//Render background image
|
||||
m_menuMainBG.Render(m_menuMainBG_x, m_menuMainBG_y);
|
||||
|
||||
//Render background image
|
||||
m_menuMainBG.Render(m_menuMainBG_x, m_menuMainBG_y);
|
||||
//Display some text
|
||||
g_font.Render("Press RSTICK THUMB to exit. Press START and/or A to launch a rom.", 65, 430, 16, XFONT_NORMAL, m_menuMainTitle_c);
|
||||
|
||||
//Display some text
|
||||
g_font.Render("Press RSTICK THUMB to exit. Press START and/or A to launch a rom.", 65, 430, 16, XFONT_NORMAL, m_menuMainTitle_c);
|
||||
//Begin with the rom selector panel
|
||||
//FIXME: Width/Height needs to be current Rom texture width/height (or should we just leave it at a fixed size?)
|
||||
m_menuMainRomSelectPanel.Render(m_menuMainRomSelectPanel_x, m_menuMainRomSelectPanel_y, m_menuMainRomSelectPanel_w, m_menuMainRomSelectPanel_h);
|
||||
|
||||
//Begin with the rom selector panel
|
||||
//FIXME: Width/Height needs to be current Rom texture width/height (or should we just leave it at a fixed size?)
|
||||
m_menuMainRomSelectPanel.Render(m_menuMainRomSelectPanel_x, m_menuMainRomSelectPanel_y, m_menuMainRomSelectPanel_w, m_menuMainRomSelectPanel_h);
|
||||
dword dwSpacing = 0;
|
||||
|
||||
dword dwSpacing = 0;
|
||||
|
||||
for (int i = m_romListBeginRender; i <= m_romListEndRender; i++)
|
||||
{
|
||||
g_romList.GetRomAt(i + m_romListOffset)->GetTexture().Render(m_menuMainRomListPos_x, m_menuMainRomListPos_y + dwSpacing);
|
||||
dwSpacing += m_menuMainRomListSpacing;
|
||||
}
|
||||
for (int i = m_romListBeginRender; i <= m_romListEndRender; i++)
|
||||
{
|
||||
g_romList.GetRomAt(i + m_romListOffset)->GetTexture().Render(m_menuMainRomListPos_x, m_menuMainRomListPos_y + dwSpacing);
|
||||
dwSpacing += m_menuMainRomListSpacing;
|
||||
}
|
||||
}
|
||||
|
||||
static uint16_t old_input_state = 0;
|
||||
@ -157,79 +143,72 @@ void CMenuMain::ProcessInput()
|
||||
|
||||
uint16_t trigger_state = input_state & ~old_input_state;
|
||||
|
||||
if(trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_DOWN))
|
||||
{
|
||||
if(m_romListSelectedRom < g_romList.GetRomListSize())
|
||||
{
|
||||
if(trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_DOWN))
|
||||
{
|
||||
if(m_romListSelectedRom < g_romList.GetRomListSize())
|
||||
{
|
||||
if(m_menuMainRomSelectPanel_y < (m_menuMainRomListPos_y + (m_menuMainRomListSpacing * m_romListEndRender)))
|
||||
{
|
||||
m_menuMainRomSelectPanel_y += m_menuMainRomListSpacing;
|
||||
m_romListSelectedRom++;
|
||||
RARCH_LOG("SELECTED ROM: %d.\n", m_romListSelectedRom);
|
||||
}
|
||||
|
||||
if(m_menuMainRomSelectPanel_y < (m_menuMainRomListPos_y + (m_menuMainRomListSpacing * m_romListEndRender)))
|
||||
{
|
||||
m_menuMainRomSelectPanel_y += m_menuMainRomListSpacing;
|
||||
m_romListSelectedRom++;
|
||||
RARCH_LOG("SELECTED ROM: %d.\n", m_romListSelectedRom);
|
||||
}
|
||||
if(m_menuMainRomSelectPanel_y > (m_menuMainRomListPos_y + (m_menuMainRomListSpacing * (m_romListEndRender))))
|
||||
{
|
||||
m_menuMainRomSelectPanel_y -= m_menuMainRomListSpacing;
|
||||
m_romListSelectedRom++;
|
||||
if(m_romListSelectedRom > g_romList.GetRomListSize() - 1)
|
||||
m_romListSelectedRom = g_romList.GetRomListSize() - 1;
|
||||
|
||||
if(m_menuMainRomSelectPanel_y > (m_menuMainRomListPos_y + (m_menuMainRomListSpacing * (m_romListEndRender))))
|
||||
{
|
||||
m_menuMainRomSelectPanel_y -= m_menuMainRomListSpacing;
|
||||
m_romListSelectedRom++;
|
||||
if(m_romListSelectedRom > g_romList.GetRomListSize() - 1)
|
||||
{
|
||||
m_romListSelectedRom = g_romList.GetRomListSize() - 1;
|
||||
}
|
||||
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)
|
||||
{
|
||||
m_romListOffset++;
|
||||
RARCH_LOG("OFFSET: %d.\n", m_romListOffset);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RARCH_LOG("SELECTED ROM AFTER CORRECTION: %d.\n", m_romListSelectedRom);
|
||||
if(trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_UP))
|
||||
{
|
||||
if(m_romListSelectedRom > -1)
|
||||
{
|
||||
if(m_menuMainRomSelectPanel_y > (m_menuMainRomListPos_y - m_menuMainRomListSpacing))
|
||||
{
|
||||
m_menuMainRomSelectPanel_y -= m_menuMainRomListSpacing;
|
||||
m_romListSelectedRom--;
|
||||
RARCH_LOG("SELECTED ROM: %d.\n", m_romListSelectedRom);
|
||||
}
|
||||
|
||||
if(m_romListSelectedRom < g_romList.GetRomListSize() - 1 && m_romListOffset < g_romList.GetRomListSize() - 1 - m_romListEndRender - 1) {
|
||||
m_romListOffset++;
|
||||
RARCH_LOG("OFFSET: %d.\n", m_romListOffset);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(m_menuMainRomSelectPanel_y < (m_menuMainRomListPos_y - m_menuMainRomListSpacing))
|
||||
{
|
||||
m_menuMainRomSelectPanel_y += m_menuMainRomListSpacing;
|
||||
m_romListSelectedRom--;
|
||||
if(m_romListSelectedRom < 0)
|
||||
m_romListSelectedRom = 0;
|
||||
|
||||
if(trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_UP))
|
||||
{
|
||||
if(m_romListSelectedRom > -1)
|
||||
{
|
||||
if(m_menuMainRomSelectPanel_y > (m_menuMainRomListPos_y - m_menuMainRomListSpacing))
|
||||
{
|
||||
m_menuMainRomSelectPanel_y -= m_menuMainRomListSpacing;
|
||||
m_romListSelectedRom--;
|
||||
RARCH_LOG("SELECTED ROM: %d.\n", m_romListSelectedRom);
|
||||
}
|
||||
RARCH_LOG("SELECTED ROM AFTER CORRECTION: %d.\n", m_romListSelectedRom);
|
||||
|
||||
if(m_menuMainRomSelectPanel_y < (m_menuMainRomListPos_y - m_menuMainRomListSpacing))
|
||||
{
|
||||
m_menuMainRomSelectPanel_y += m_menuMainRomListSpacing;
|
||||
m_romListSelectedRom--;
|
||||
if(m_romListSelectedRom < 0)
|
||||
{
|
||||
m_romListSelectedRom = 0;
|
||||
}
|
||||
if(m_romListSelectedRom > 0 && m_romListOffset > 0)
|
||||
{
|
||||
m_romListOffset--;
|
||||
RARCH_LOG("OFFSET: %d.\n", m_romListOffset);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
RARCH_LOG("SELECTED ROM AFTER CORRECTION: %d.\n", m_romListSelectedRom);
|
||||
|
||||
if(m_romListSelectedRom > 0 && m_romListOffset > 0) {
|
||||
m_romListOffset--;
|
||||
RARCH_LOG("OFFSET: %d.\n", m_romListOffset);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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))
|
||||
{
|
||||
// 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))
|
||||
rarch_console_load_game(g_romList.GetRomAt(m_romListSelectedRom)->GetFileName().c_str());
|
||||
}
|
||||
|
||||
if (trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_R3))
|
||||
{
|
||||
LD_LAUNCH_DASHBOARD LaunchData = { XLD_LAUNCH_DASHBOARD_MAIN_MENU };
|
||||
XLaunchNewImage( NULL, (LAUNCH_DATA*)&LaunchData );
|
||||
}
|
||||
if (trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_R3))
|
||||
{
|
||||
LD_LAUNCH_DASHBOARD LaunchData = { XLD_LAUNCH_DASHBOARD_MAIN_MENU };
|
||||
XLaunchNewImage( NULL, (LAUNCH_DATA*)&LaunchData );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,12 +17,6 @@
|
||||
#include "Global.h"
|
||||
#include "Surface.h"
|
||||
|
||||
enum DisplayMode
|
||||
{
|
||||
Box,
|
||||
List
|
||||
};
|
||||
|
||||
class CMenuMain
|
||||
{
|
||||
public:
|
||||
@ -69,21 +63,6 @@ int m_menuMainRomListPos_x;
|
||||
int m_menuMainRomListPos_y;
|
||||
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
|
||||
*/
|
||||
|
@ -31,42 +31,38 @@ CMenuManager::~CMenuManager()
|
||||
|
||||
bool CMenuManager::Create()
|
||||
{
|
||||
//Create the MenuManager, set to Main Menu
|
||||
RARCH_LOG("Create MenuManager, set state to MENU_MAIN.\n");
|
||||
SetMenuState(MENU_MAIN);
|
||||
//Create the MenuManager, set to Main Menu
|
||||
RARCH_LOG("Create MenuManager, set state to MENU_MAIN.\n");
|
||||
SetMenuState(MENU_MAIN);
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CMenuManager::SetMenuState(int nMenuID)
|
||||
{
|
||||
m_pMenuID = nMenuID;
|
||||
m_pMenuID = nMenuID;
|
||||
|
||||
switch (m_pMenuID) {
|
||||
case MENU_MAIN:
|
||||
//Create the Main Menu
|
||||
g_menuMain.Create();
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
switch (m_pMenuID)
|
||||
{
|
||||
case MENU_MAIN:
|
||||
//Create the Main Menu
|
||||
g_menuMain.Create();
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void CMenuManager::Update()
|
||||
{
|
||||
//Process overall input
|
||||
ProcessInput();
|
||||
|
||||
switch (m_pMenuID) {
|
||||
case MENU_MAIN:
|
||||
|
||||
// Process menu specific input
|
||||
g_menuMain.ProcessInput();
|
||||
|
||||
// Render the Main Menu
|
||||
g_menuMain.Render();
|
||||
break;
|
||||
}
|
||||
ProcessInput();
|
||||
|
||||
switch (m_pMenuID)
|
||||
{
|
||||
case MENU_MAIN:
|
||||
g_menuMain.ProcessInput();
|
||||
g_menuMain.Render();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -74,10 +70,8 @@ void CMenuManager::ProcessInput()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
int CMenuManager::GetMenuState()
|
||||
{
|
||||
return m_pMenuID;
|
||||
return m_pMenuID;
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,6 @@ enum eMenuState
|
||||
MENU_LAUNCHER
|
||||
};
|
||||
|
||||
|
||||
class CMenuManager
|
||||
{
|
||||
public:
|
||||
@ -47,4 +46,4 @@ int m_pMenuID;
|
||||
|
||||
};
|
||||
|
||||
extern CMenuManager g_menuManager;
|
||||
extern CMenuManager g_menuManager;
|
||||
|
@ -14,7 +14,6 @@
|
||||
*/
|
||||
|
||||
#include "Rom.h"
|
||||
//#include "BoxArtTable.h"
|
||||
|
||||
Rom::Rom()
|
||||
{
|
||||
@ -25,28 +24,21 @@ Rom::~Rom(void)
|
||||
{
|
||||
}
|
||||
|
||||
bool Rom::Load(const string &szFilename)
|
||||
bool Rom::Load(const char *szFilename)
|
||||
{
|
||||
if (m_bLoaded)
|
||||
return true;
|
||||
|
||||
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;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Rom::LoadFromCache(const string &szFilename, const string &szBoxArtFilename)
|
||||
bool Rom::LoadFromCache(const string &szFilename)
|
||||
{
|
||||
m_szFilename = szFilename;
|
||||
m_szBoxArtFilename = szBoxArtFilename;
|
||||
|
||||
m_bLoaded = true;
|
||||
|
||||
@ -58,11 +50,6 @@ string Rom::GetFileName()
|
||||
return m_szFilename;
|
||||
}
|
||||
|
||||
string Rom::GetBoxArtFilename()
|
||||
{
|
||||
return m_szBoxArtFilename;
|
||||
}
|
||||
|
||||
string Rom::GetComments()
|
||||
{
|
||||
//return string(m_iniEntry->szComments);
|
||||
|
@ -24,20 +24,14 @@ public:
|
||||
Rom();
|
||||
~Rom();
|
||||
|
||||
bool Load(const string &szFilename);
|
||||
bool LoadFromCache(const string &szFilename, const string &szBoxArtFilename);
|
||||
bool Load(const char *szFilename);
|
||||
bool LoadFromCache(const string &szFilename);
|
||||
|
||||
string GetFileName();
|
||||
string GetBoxArtFilename();
|
||||
string GetComments();
|
||||
|
||||
CSurface &GetTexture();
|
||||
|
||||
private:
|
||||
string m_szFilename;
|
||||
string m_szBoxArtFilename;
|
||||
|
||||
bool m_bLoaded;
|
||||
|
||||
CSurface m_texture;
|
||||
};
|
||||
|
@ -24,7 +24,6 @@ bool RLessThan(Rom *elem1, Rom *elem2)
|
||||
|
||||
RomList::RomList(void)
|
||||
{
|
||||
m_romListMode = All;
|
||||
m_iBaseIndex = 0;
|
||||
m_bLoaded = false;
|
||||
m_szRomPath = "D:\\";
|
||||
@ -51,14 +50,12 @@ void RomList::Load()
|
||||
while (!cacheFile.eof())
|
||||
{
|
||||
string szFilename;
|
||||
string szBoxArtFilename;
|
||||
|
||||
getline(cacheFile, szFilename);
|
||||
getline(cacheFile, szBoxArtFilename);
|
||||
|
||||
Rom *rom = new Rom();
|
||||
|
||||
bool bSuccess = rom->LoadFromCache(szFilename, szBoxArtFilename);
|
||||
bool bSuccess = rom->LoadFromCache(szFilename);
|
||||
|
||||
if (bSuccess)
|
||||
m_romList.push_back(rom);
|
||||
@ -85,7 +82,6 @@ void RomList::Save()
|
||||
Rom *rom = *i;
|
||||
|
||||
cacheFile << rom->GetFileName() << endl;
|
||||
cacheFile << rom->GetBoxArtFilename() << endl;
|
||||
}
|
||||
|
||||
cacheFile.close();
|
||||
@ -103,29 +99,11 @@ bool RomList::IsLoaded()
|
||||
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)
|
||||
{
|
||||
vector<Rom *> *pList;
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case All:
|
||||
pList = &m_romList;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
pList = &m_romList;
|
||||
|
||||
// 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++)
|
||||
@ -141,15 +119,8 @@ void RomList::AddRomToList(Rom *rom, int mode)
|
||||
void RomList::RemoveRomFromList(Rom *rom, int mode)
|
||||
{
|
||||
vector<Rom *> *pList;
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case All:
|
||||
pList = &m_romList;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
pList = &m_romList;
|
||||
|
||||
vector<Rom *>::iterator i;
|
||||
|
||||
@ -186,38 +157,19 @@ void RomList::SetBaseIndex(int index)
|
||||
|
||||
int RomList::GetRomListSize()
|
||||
{
|
||||
switch (m_romListMode)
|
||||
{
|
||||
case All:
|
||||
return m_romList.size();
|
||||
}
|
||||
|
||||
return 0;
|
||||
return m_romList.size();
|
||||
}
|
||||
|
||||
Rom *RomList::GetRomAt(int index)
|
||||
{
|
||||
switch (m_romListMode)
|
||||
{
|
||||
case All:
|
||||
return m_romList[index];
|
||||
}
|
||||
|
||||
return 0;
|
||||
return m_romList[index];
|
||||
}
|
||||
|
||||
int RomList::FindRom(Rom *rom, int mode)
|
||||
{
|
||||
vector<Rom *> *pList;
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case All:
|
||||
pList = &m_romList;
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
||||
pList = &m_romList;
|
||||
|
||||
for (int i = 0; i < static_cast<int>(pList->size()); i++)
|
||||
{
|
||||
|
@ -18,11 +18,6 @@
|
||||
#include "Global.h"
|
||||
#include "Rom.h"
|
||||
|
||||
enum RomListMode
|
||||
{
|
||||
All
|
||||
};
|
||||
|
||||
class RomList
|
||||
{
|
||||
public:
|
||||
@ -35,9 +30,6 @@ public:
|
||||
|
||||
bool IsLoaded();
|
||||
|
||||
void SetRomListMode(int mode);
|
||||
int GetRomListMode();
|
||||
|
||||
void AddRomToList(Rom *rom, int mode);
|
||||
void RemoveRomFromList(Rom *rom, int mode);
|
||||
|
||||
@ -61,11 +53,7 @@ private:
|
||||
void Destroy();
|
||||
|
||||
private:
|
||||
|
||||
bool m_bLoaded;
|
||||
|
||||
int m_romListMode;
|
||||
|
||||
string m_szRomPath;
|
||||
};
|
||||
|
||||
|
@ -215,13 +215,6 @@ void CSurface::SetOpacity(byte 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)
|
||||
{
|
||||
m_x = x;
|
||||
|
@ -43,7 +43,6 @@ public:
|
||||
* Set functions
|
||||
*/
|
||||
void SetOpacity(byte opacity);
|
||||
void SetTint(byte r, byte g, byte b);
|
||||
|
||||
void MoveTo(int x, int y);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user