Fixed path of banner.bin in GamelistCtrl not getting the good TitleID, replaced fullscreen on Esc key by Alt+Enter, Esc now escape fullscreen or stop emulation (as requested, but i find it better too)

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3101 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
sl1nk3.s 2009-04-28 23:47:18 +00:00
parent be61375c01
commit 870242fc79
7 changed files with 127 additions and 94 deletions

View File

@ -23,6 +23,7 @@
#include "ColorUtil.h"
#include "BannerLoaderWii.h"
#include "FileUtil.h"
#include "../../Core/Src/VolumeHandler.h"
namespace DiscIO
{
@ -32,11 +33,13 @@ CBannerLoaderWii::CBannerLoaderWii(DiscIO::IFileSystem& _rFileSystem)
, m_IsValid(false)
{
char Filename[260];
char TitleID[4];
_rFileSystem.GetVolume()->Read(0, 4, (u8*)TitleID);
sprintf(Filename, FULL_WII_USER_DIR "title/00010000/%02x%02x%02x%02x/data/banner.bin",
(u8)TitleID[0], (u8)TitleID[1], (u8)TitleID[2], (u8)TitleID[3]);
u64 TitleID;
_rFileSystem.GetVolume()->RAWRead((u64)0x0F8001DC, 8, (u8*)&TitleID);
TitleID = Common::swap64(TitleID);
sprintf(Filename, FULL_WII_USER_DIR "title/%08x/%08x/data/banner.bin",
(u32)(TitleID>>32), (u32)TitleID);
if (!File::Exists(Filename))
{

View File

@ -166,8 +166,6 @@ bool CFileSystemGCWii::InitFileSystem()
}
else
{
// Mario Kart Wii gets here on its third partition...
// Does it use a fake partition ? another type we don't know ?
return false;
}

View File

@ -178,8 +178,10 @@ int abc = 0;
case OPENGL_WM_USER_CREATE:
// We don't have a local setting for bRenderToMain but we can detect it this way instead
//PanicAlert("main call %i %i %i %i", lParam, (HWND)Core::GetWindowHandle(), MSWGetParent_((HWND)Core::GetWindowHandle()), (HWND)this->GetHWND());
if (lParam == NULL) main_frame->bRenderToMain = false;
else main_frame->bRenderToMain = true;
if (lParam == NULL)
main_frame->bRenderToMain = false;
else
main_frame->bRenderToMain = true;
return 0;
case NJOY_RELOAD:
@ -470,7 +472,6 @@ void CFrame::OnClose(wxCloseEvent& event)
}
#endif
void CFrame::OnHostMessage(wxCommandEvent& event)
{
switch (event.GetId())
@ -496,13 +497,25 @@ void CFrame::OnGameListCtrl_ItemActivated(wxListEvent& WXUNUSED (event))
void CFrame::OnKeyDown(wxKeyEvent& event)
{
// Toggle fullscreen from Alt + Enter or Esc
if (((event.GetKeyCode() == WXK_RETURN) && (event.GetModifiers() == wxMOD_ALT)) ||
(event.GetKeyCode() == WXK_ESCAPE))
// Escape key turn off fullscreen then Stop emulation in windowed mode
if (event.GetKeyCode() == WXK_ESCAPE)
{
ShowFullScreen(!IsFullScreen());
if (IsFullScreen())
{
ShowFullScreen(false);
MSWSetCursor(true);
}
else
DoStop();
UpdateGUI();
}
if (event.GetKeyCode() == WXK_RETURN && event.GetModifiers() == wxMOD_ALT)
{
// For some reasons, wxWidget doesn't proccess the Alt+Enter event there on windows.
// But still, pressing Alt+Enter make it Fullscreen, So this is for other OS... :P
ShowFullScreen(!IsFullScreen());
}
#ifdef _WIN32
if(event.GetKeyCode() == 'E','M') // Send this to the video plugin WndProc
{
@ -596,8 +609,9 @@ void CFrame::OnDoubleClick(wxMouseEvent& event)
MSWSetCursor(true); // Show the cursor again, in case it was hidden
#endif
m_fLastClickTime -= 10; // Don't treat repeated clicks as double clicks
}
// --------------------------
}
UpdateGUI();
}

View File

@ -579,6 +579,11 @@ void CFrame::DoStop()
if (Core::GetState() != Core::CORE_UNINITIALIZED)
{
// Ask for confirmation in case the user accidently clicked Stop / Escape
if(SConfig::GetInstance().m_LocalCoreStartupParameter.bConfirmStop)
if(!AskYesNo("Are you sure you want to stop the current emulation?", "Confirm", wxYES_NO))
return;
Core::Stop();
/* This is needed together with the option to not "delete g_EmuThread" in Core.cpp, because then
@ -600,19 +605,7 @@ void CFrame::DoStop()
void CFrame::OnStop(wxCommandEvent& WXUNUSED (event))
{
// Ask for confirmation in case the user accidently clicked Stop
bool answer;
if(SConfig::GetInstance().m_LocalCoreStartupParameter.bConfirmStop)
{
answer = AskYesNo("Are you sure you want to stop the current emulation?",
"Confirm", wxYES_NO);
}
else
{
answer = true;
}
if (answer) DoStop();
DoStop();
}
////////////////////////////////////////////////////

View File

@ -210,7 +210,7 @@ void ConfigDialog::CreateGUIControls()
// Tool tips
m_Fullscreen->SetToolTip(wxT(
"This will create a Fullscreen window using the chosen Fullscreen resolution."
"\nPress Esc key to switch between Fullscreen and Windowed mode."
"\nPress Alt+Enter to switch between Fullscreen and Windowed mode."
));
m_NativeResolution->SetToolTip(wxT(
"This will use the game's native resolution and stretch it to fill the"

View File

@ -213,76 +213,36 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
EndPaint( hWnd, &ps );
return 0;
case WM_SYSKEYDOWN:
switch( LOWORD( wParam ))
{
case VK_RETURN:
// Pressing Alt+Enter switch FullScreen/Windowed
if (m_hParent == NULL && !g_Config.renderToMainframe)
{
ToggleFullscreen(hWnd);
return 0;
}
break;
}
break;
case WM_KEYDOWN:
switch( LOWORD( wParam ))
{
case VK_ESCAPE:
// Pressing Esc switch FullScreen/Windowed
if (m_hParent == NULL)
{
int w_fs = 640, h_fs = 480;
if (g_Config.bFullscreen)
{
// Get out of fullscreen
g_Config.bFullscreen = false;
RECT rc = {0, 0, w_fs, h_fs};
if (strlen(g_Config.iWindowedRes) > 1)
sscanf(g_Config.iWindowedRes, "%dx%d", &w_fs, &h_fs);
// FullScreen -> Desktop
ChangeDisplaySettings(NULL, 0);
RECT rcdesktop; // Get desktop resolution
GetWindowRect(GetDesktopWindow(), &rcdesktop);
// Re-Enable the cursor
ShowCursor(TRUE);
int X = (rcdesktop.right-rcdesktop.left)/2 - (rc.right-rc.left)/2;
int Y = (rcdesktop.bottom-rcdesktop.top)/2 - (rc.bottom-rc.top)/2;
// SetWindowPos to the center of the screen
SetWindowPos(hWnd, NULL, X, Y, w_fs, h_fs, SWP_NOREPOSITION | SWP_NOZORDER);
// Set new window style FS -> Windowed
SetWindowLong(hWnd, GWL_STYLE, WS_OVERLAPPEDWINDOW);
// Eventually show the window!
EmuWindow::Show();
}
else
{
// Get into fullscreen
g_Config.bFullscreen = true;
DEVMODE dmScreenSettings;
memset(&dmScreenSettings, 0, sizeof(dmScreenSettings));
if (strlen(g_Config.iFSResolution) > 1)
sscanf(g_Config.iFSResolution, "%dx%d", &w_fs, &h_fs);
// Desktop -> FullScreen
dmScreenSettings.dmSize = sizeof(dmScreenSettings);
dmScreenSettings.dmPelsWidth = w_fs;
dmScreenSettings.dmPelsHeight = h_fs;
dmScreenSettings.dmBitsPerPel = 32;
dmScreenSettings.dmFields = DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;
if (ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL)
return 0;
// Set new window style -> PopUp
SetWindowLong(hWnd, GWL_STYLE, WS_POPUP);
// Disable the cursor
ShowCursor(FALSE);
// SetWindowPos to the upper-left corner of the screen
SetWindowPos(hWnd, NULL, 0, 0, w_fs, h_fs, SWP_NOREPOSITION | SWP_NOZORDER);
// Eventually show the window!
EmuWindow::Show();
}
if (g_Config.bFullscreen)
{
// Pressing Esc switch to Windowed in Fullscreen mode
ToggleFullscreen(hWnd);
return 0;
}
}
else if (!g_Config.renderToMainframe)
{
// And stops the emulation when already in Windowed mode
PostMessage(m_hMain, WM_USER, OPENGL_WM_USER_STOP, 0);
}
break;
case 'E': // EFB hotkey
if (g_Config.bEFBCopyDisableHotKey)
{
@ -433,6 +393,70 @@ HWND OpenWindow(HWND parent, HINSTANCE hInstance, int width, int height, const T
return m_hWnd;
}
void ToggleFullscreen(HWND hParent)
{
if (m_hParent == NULL)
{
int w_fs = 640, h_fs = 480;
if (g_Config.bFullscreen)
{
// Get out of fullscreen
g_Config.bFullscreen = false;
RECT rc = {0, 0, w_fs, h_fs};
if (strlen(g_Config.iWindowedRes) > 1)
sscanf(g_Config.iWindowedRes, "%dx%d", &w_fs, &h_fs);
// FullScreen -> Desktop
ChangeDisplaySettings(NULL, 0);
RECT rcdesktop; // Get desktop resolution
GetWindowRect(GetDesktopWindow(), &rcdesktop);
ShowCursor(TRUE);
int X = (rcdesktop.right-rcdesktop.left)/2 - (rc.right-rc.left)/2;
int Y = (rcdesktop.bottom-rcdesktop.top)/2 - (rc.bottom-rc.top)/2;
// SetWindowPos to the center of the screen
SetWindowPos(hParent, NULL, X, Y, w_fs, h_fs, SWP_NOREPOSITION | SWP_NOZORDER);
// Set new window style FS -> Windowed
SetWindowLong(hParent, GWL_STYLE, WS_OVERLAPPEDWINDOW);
// Eventually show the window!
EmuWindow::Show();
}
else
{
// Get into fullscreen
DEVMODE dmScreenSettings;
memset(&dmScreenSettings, 0, sizeof(dmScreenSettings));
if (strlen(g_Config.iFSResolution) > 1)
sscanf(g_Config.iFSResolution, "%dx%d", &w_fs, &h_fs);
// Desktop -> FullScreen
dmScreenSettings.dmSize = sizeof(dmScreenSettings);
dmScreenSettings.dmPelsWidth = w_fs;
dmScreenSettings.dmPelsHeight = h_fs;
dmScreenSettings.dmBitsPerPel = 32;
dmScreenSettings.dmFields = DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;
if (ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL)
return;
// Set new window style -> PopUp
SetWindowLong(hParent, GWL_STYLE, WS_POPUP);
g_Config.bFullscreen = true;
ShowCursor(FALSE);
// SetWindowPos to the upper-left corner of the screen
SetWindowPos(hParent, NULL, 0, 0, w_fs, h_fs, SWP_NOREPOSITION | SWP_NOZORDER);
// Eventually show the window!
EmuWindow::Show();
}
}
}
void Show()
{
ShowWindow(m_hWnd, SW_SHOW);

View File

@ -32,6 +32,7 @@ namespace EmuWindow
HWND Create(HWND hParent, HINSTANCE hInstance, const TCHAR *title);
void Show();
void Close();
void ToggleFullscreen(HWND hParent);
void SetSize(int displayWidth, int displayHeight);
}