diff --git a/xbox1/frontend/RetroLaunch/MenuMain.cpp b/xbox1/frontend/RetroLaunch/MenuMain.cpp index 4ef0446f8c..03e6e8ee5c 100644 --- a/xbox1/frontend/RetroLaunch/MenuMain.cpp +++ b/xbox1/frontend/RetroLaunch/MenuMain.cpp @@ -26,6 +26,13 @@ CMenuMain::CMenuMain() { // we think that the rom list is unloaded until we know otherwise m_bRomListLoadedState = false; + + struct retro_system_info info; + retro_get_system_info(&info); + const char *id = info.library_name ? info.library_name : "Unknown"; + char core_text[256]; + snprintf(core_text, sizeof(core_text), "%s %s", id, info.library_version); + convert_char_to_wchar(m_title, core_text, sizeof(m_title)); } CMenuMain::~CMenuMain() @@ -91,21 +98,14 @@ bool CMenuMain::Create() if(m_romListEndRender > g_romList.GetRomListSize() - 1) m_romListEndRender = g_romList.GetRomListSize() - 1; - //Generate the rom list textures only once - vector::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; } void CMenuMain::Render() { + xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data; + //Render background image m_menuMainBG.Render(m_menuMainBG_x, m_menuMainBG_y); @@ -113,8 +113,15 @@ void CMenuMain::Render() //Center the text (hardcoded) int xpos = width == 640 ? 65 : 400; int ypos = width == 640 ? 430 : 670; - - g_font.Render("Press RSTICK THUMB to exit. Press START and/or A to launch a rom.", xpos, ypos, 16, XFONT_NORMAL, m_menuMainTitle_c); + + d3d->d3d_render_device->GetBackBuffer(-1, D3DBACKBUFFER_TYPE_MONO, &d3d->pFrontBuffer); + d3d->d3d_render_device->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &d3d->pBackBuffer); + d3d->debug_font->TextOut(d3d->pFrontBuffer, L"Libretro core:", (unsigned)-1, xpos, ypos); + d3d->debug_font->TextOut(d3d->pBackBuffer, L"Libretro core:", (unsigned)-1, xpos, ypos); + d3d->debug_font->TextOut(d3d->pFrontBuffer, m_title, (unsigned)-1, xpos + 140, ypos); + d3d->debug_font->TextOut(d3d->pBackBuffer, m_title, (unsigned)-1, xpos + 140, ypos); + d3d->pFrontBuffer->Release(); + d3d->pBackBuffer->Release(); //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?) @@ -124,7 +131,13 @@ void CMenuMain::Render() for (int i = m_romListBeginRender; i <= m_romListEndRender; i++) { - g_romList.GetRomAt(i + m_romListOffset)->GetTexture().Render(m_menuMainRomListPos_x, m_menuMainRomListPos_y + dwSpacing); + const wchar_t *rom_basename = g_romList.GetRomAt(i + m_romListOffset)->GetFileName(); + d3d->d3d_render_device->GetBackBuffer(-1, D3DBACKBUFFER_TYPE_MONO, &d3d->pFrontBuffer); + d3d->d3d_render_device->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &d3d->pBackBuffer); + d3d->debug_font->TextOut(d3d->pFrontBuffer, rom_basename, (unsigned)-1, m_menuMainRomListPos_x, m_menuMainRomListPos_y + dwSpacing); + d3d->debug_font->TextOut(d3d->pBackBuffer, rom_basename, (unsigned)-1, m_menuMainRomListPos_x, m_menuMainRomListPos_y + dwSpacing); + d3d->pFrontBuffer->Release(); + d3d->pBackBuffer->Release(); dwSpacing += m_menuMainRomListSpacing; } } @@ -215,7 +228,11 @@ void CMenuMain::ProcessInput() // Press A to launch if (trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_B) || trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_START)) - rarch_console_load_game_wrap(g_romList.GetRomAt(m_romListSelectedRom)->GetFileName().c_str(), g_console.zip_extract_mode, S_DELAY_1); + { + char rom_filename[PATH_MAX]; + convert_wchar_to_char(rom_filename, g_romList.GetRomAt(m_romListSelectedRom)->GetFileName(), sizeof(rom_filename)); + rarch_console_load_game_wrap(rom_filename, g_console.zip_extract_mode, S_DELAY_1); + } if (trigger_state & (1 << RETRO_DEVICE_ID_JOYPAD_R3)) { diff --git a/xbox1/frontend/RetroLaunch/MenuMain.h b/xbox1/frontend/RetroLaunch/MenuMain.h index 22c16ebfcc..72d64e5233 100644 --- a/xbox1/frontend/RetroLaunch/MenuMain.h +++ b/xbox1/frontend/RetroLaunch/MenuMain.h @@ -76,7 +76,7 @@ int m_romListOffset; // Backbuffer width, height int width; int height; - +wchar_t m_title[128]; }; extern CMenuMain g_menuMain; diff --git a/xbox1/frontend/RetroLaunch/Rom.cpp b/xbox1/frontend/RetroLaunch/Rom.cpp index cf7505d91d..10509e1760 100644 --- a/xbox1/frontend/RetroLaunch/Rom.cpp +++ b/xbox1/frontend/RetroLaunch/Rom.cpp @@ -29,19 +29,13 @@ bool Rom::Load(const char *szFilename) if (m_bLoaded) return true; - m_szFilename = szFilename; - + convert_char_to_wchar(m_szFilename, szFilename, sizeof(m_szFilename)); m_bLoaded = true; return true; } -string Rom::GetFileName() +const wchar_t *Rom::GetFileName() { return m_szFilename; -} - -CSurface &Rom::GetTexture() -{ - return m_texture; } \ No newline at end of file diff --git a/xbox1/frontend/RetroLaunch/Rom.h b/xbox1/frontend/RetroLaunch/Rom.h index c0bf815e28..a93a2901be 100644 --- a/xbox1/frontend/RetroLaunch/Rom.h +++ b/xbox1/frontend/RetroLaunch/Rom.h @@ -16,7 +16,6 @@ #pragma once #include "Global.h" -#include "Surface.h" class Rom { @@ -26,10 +25,8 @@ public: bool Load(const char *szFilename); - string GetFileName(); - CSurface &GetTexture(); + const wchar_t *GetFileName(); private: - string m_szFilename; + wchar_t m_szFilename[256]; bool m_bLoaded; - CSurface m_texture; }; diff --git a/xbox1/frontend/RetroLaunch/RomList.cpp b/xbox1/frontend/RetroLaunch/RomList.cpp index c563173704..399a820896 100644 --- a/xbox1/frontend/RetroLaunch/RomList.cpp +++ b/xbox1/frontend/RetroLaunch/RomList.cpp @@ -110,30 +110,6 @@ Rom *RomList::GetRomAt(int index) return m_romList[index]; } -void RomList::CleanUpTextures() -{ - if (!IsLoaded()) - return; - - // keep the 25 textures above and below the base index - for (int i = 0; i < m_iBaseIndex - 25; i++) - m_romList[i]->GetTexture().Destroy(); - - for (int i = m_iBaseIndex + 25; i < GetRomListSize(); i++) - m_romList[i]->GetTexture().Destroy(); -} - -void RomList::DestroyAllTextures() -{ - vector::iterator i; - - for (i = m_romList.begin(); i != m_romList.end(); i++) - { - Rom *rom = *i; - rom->GetTexture().Destroy(); - } -} - void RomList::Build() { WIN32_FIND_DATA fd; diff --git a/xbox1/frontend/RetroLaunch/RomList.h b/xbox1/frontend/RetroLaunch/RomList.h index d7c0171256..729a578036 100644 --- a/xbox1/frontend/RetroLaunch/RomList.h +++ b/xbox1/frontend/RetroLaunch/RomList.h @@ -39,9 +39,6 @@ public: Rom *GetRomAt(int index); - void CleanUpTextures(); - void DestroyAllTextures(); - int m_iBaseIndex; vector m_romList;