Fix for tatsunoko vs capcom and those wii games getting corrupted memory error

+ a couple of (serious...) fixes for some of my mistakes, and some warning fixes

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3411 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
sl1nk3.s 2009-06-12 15:47:41 +00:00
parent a1fd2defc4
commit d99deae17d
8 changed files with 22 additions and 23 deletions

View File

@ -22,7 +22,7 @@ AudioCommonConfig ac_Config;
void AudioCommonConfig::Load(IniFile &file) {
file.Get("Config", "EnableDTKMusic", &m_EnableDTKMusic, true);
file.Get("Config", "EnableThrottle", &m_EnableThrottle, true);
file.Get("Config", "Volume", &m_Volume, 0);
file.Get("Config", "Volume", &m_Volume, 75);
#ifdef _WIN32
file.Get("Config", "Backend", &sBackend, "DSound");
#elif defined(__APPLE__)

View File

@ -633,7 +633,7 @@ bool ReadFileToString(bool text_file, const char *filename, std::string &str)
if (!f)
return false;
fseek(f, 0, SEEK_END);
size_t len = ftell(f);
size_t len = (size_t)ftell(f);
fseek(f, 0, SEEK_SET);
char *buf = new char[len + 1];
buf[fread(buf, 1, len, f)] = 0;

View File

@ -672,16 +672,16 @@ void Callback_VideoCopiedToXFB()
frames++;
if (targetfps>0)
if (targetfps > 0)
{
new_frametime=Timer.GetTimeDifference()-old_frametime;
new_frametime = Timer.GetTimeDifference() - old_frametime;
old_frametime=Timer.GetTimeDifference();
old_frametime = Timer.GetTimeDifference();
wait_frametime=((1000/targetfps)-new_frametime);
if (targetfps<35)
wait_frametime = (1000/targetfps) - (u16)new_frametime;
if (targetfps < 35)
wait_frametime--;
if (wait_frametime>0)
if (wait_frametime > 0)
Common::SleepCurrentThread(wait_frametime*2);
}

View File

@ -94,8 +94,8 @@ CWII_IPC_HLE_Device_FileIO::Open(u32 _CommandAddress, u32 _Mode)
m_Filename = std::string(HLE_IPC_BuildFilename(GetDeviceName().c_str(), 64));
// Reading requires the file to exist
if(_Mode == 0x01 && !File::Exists(m_Filename.c_str())) {
// Reading requires the file to exist, but writing doesn't (what a smart thought)
if(_Mode != 0x02 && && !File::Exists(m_Filename.c_str())) {
ERROR_LOG(WII_IPC_FILEIO, " FileIO failed open for reading: %s - File doesn't exist", m_Filename.c_str());
ReturnValue = FS_FILE_NOT_EXIST;
} else {

View File

@ -193,7 +193,7 @@ void gdsp_idma_in(u16 dsp_addr, u32 addr, u32 size)
UnWriteProtectMemory(g_dsp.iram, DSP_IRAM_BYTE_SIZE, false);
u8* dst = ((u8*)g_dsp.iram);
for (int i = 0; i < (int)size; i += 2)
for (u32 i = 0; i < size; i += 2)
{
// TODO : this may be different on Wii.
*(u16*)&dst[dsp_addr + i] = Common::swap16(*(const u16*)&g_dsp.cpu_ram[(addr + i) & 0x0fffffff]);

View File

@ -160,7 +160,7 @@ std::string CVolumeWAD::GetName() const
// Offset to the english title
char temp[85];
if (!Read(0xF1 + OpeningBnrOffset, 84, (u8*)&temp) || footer_size < 0xF1)
if (!Read(0xF1 + OpeningBnrOffset, 84, (u8*)&temp) || Common::swap32(footer_size) < 0xF1)
return "Unknown";
char out_temp[43];

View File

@ -316,18 +316,18 @@ void CGameListCtrl::InsertItemInReportView(long _Index)
//SetItem(_Index, COLUMN_TITLE, wxString(wxString(rISOFile.GetName()).wc_str(convFrom) , convTo), -1);
//SetItem(_Index, COLUMN_NOTES, wxString(wxString(rISOFile.GetDescription()).wc_str(convFrom) , convTo), -1);
m_gameList.append(std::string(name.mb_str()) + " (J)\n");
if (CopySJISToString(name, rISOFile.GetName(0).c_str()))
SetItem(_Index, COLUMN_TITLE, name, -1);
if (CopySJISToString(description, rISOFile.GetDescription(0).c_str()))
SetItem(_Index, COLUMN_NOTES, description, -1);
m_gameList.append(std::string(name.mb_str()) + " (J)\n");
break;
case DiscIO::IVolume::COUNTRY_USA:
m_gameList.append(std::string(name.mb_str()) + " (U)\n");
if (CopySJISToString(name, rISOFile.GetName(0).c_str()))
SetItem(_Index, COLUMN_TITLE, name, -1);
if (CopySJISToString(description, rISOFile.GetDescription(0).c_str()))
SetItem(_Index, COLUMN_NOTES, description, -1);
m_gameList.append(std::string(name.mb_str()) + " (U)\n");
break;
default:
m_gameList.append(std::string(

View File

@ -73,13 +73,6 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
case DLL_PROCESS_DETACH:
#if defined(HAVE_WX) && HAVE_WX
// This causes a "stop hang", if the gfx config dialog has been opened.
/* JP: Are you sure? Because I tried to debug that for hours with countless Stop and Start
and I frequently gor the stop hang even if I did not open the wxDialog
Update: Howwver, compiling with 'HAVE_WX 0' seems to have reduced the number of hangins,
it only hanged once with that option. And that was when I stopped Starfox Assault that
by the way doesn't work now (it has a black screen).
Update again: No it was probably related to something else, now I had the same luck
with WxWidgets in it to. */
// Old comment: "Use wxUninitialize() if you don't want GUI"
wxEntryCleanup();
#endif
@ -459,10 +452,16 @@ void ToggleFullscreen(HWND hParent)
ShowCursor(TRUE);
// SetWindowPos to the center of the screen
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);
// Note: we now use the same res for fullscreen and windowed, so we need to check if the window
// is not too big here
if (w_fs == rcdesktop.right-rcdesktop.left)
SetWindowPos(hParent, NULL, X*0.75, Y*0.75, w_fs*0.75, h_fs*0.75, SWP_NOREPOSITION | SWP_NOZORDER);
else
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);