TLB hack plus some project changes. I only get a Konami logo though in MGS. Sonic1, plz fix :p
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1467 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
f51a08c604
commit
e450578710
|
@ -0,0 +1,8 @@
|
|||
# GGSEA4 - METAL GEAR SOLID THE TWIN SNAKES
|
||||
[Core]
|
||||
TLBHack=1
|
||||
[EmuState]
|
||||
#The Emulation State. 1 is worst, 5 is best, 0 is not set.
|
||||
EmulationStateId = 1
|
||||
[OnFrame]
|
||||
[ActionReplay]
|
|
@ -0,0 +1,9 @@
|
|||
# GGSPA4 - METAL GEAR SOLID THE TWIN SNAKES
|
||||
[Core]
|
||||
TLBHack = 1
|
||||
#Values set here will override the main dolphin settings.
|
||||
[EmuState]
|
||||
#The Emulation State. 1 is worst, 5 is best, 0 is not set.
|
||||
EmulationStateId = 1
|
||||
[OnFrame]
|
||||
[ActionReplay]
|
|
@ -40,6 +40,7 @@ void SCoreStartupParameter::LoadDefaults()
|
|||
bLockThreads = true;
|
||||
bWii = false;
|
||||
SelectedLanguage = 0;
|
||||
iTLBHack = 0;
|
||||
|
||||
bJITOff = false; // debugger only settings
|
||||
bJITLoadStoreOff = false;
|
||||
|
|
|
@ -59,6 +59,9 @@ struct SCoreStartupParameter
|
|||
|
||||
bool bRunCompareServer;
|
||||
bool bRunCompareClient;
|
||||
|
||||
int iTLBHack;
|
||||
|
||||
int SelectedLanguage;
|
||||
|
||||
bool bWii; bool bWiiLeds; bool bWiiSpeakers; // Wii settings
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "../PowerPC/PowerPC.h"
|
||||
#include "../PowerPC/SymbolDB.h"
|
||||
|
||||
// Not thread safe.
|
||||
void PPCDebugInterface::disasm(unsigned int address, char *dest, int max_size)
|
||||
{
|
||||
if (Core::GetState() != Core::CORE_UNINITIALIZED)
|
||||
|
|
|
@ -49,7 +49,8 @@ namespace Memory
|
|||
|
||||
// #define NOCHECK
|
||||
|
||||
static const bool bFakeVMEM = false;
|
||||
// TLBHack = 1 in a patch ini will set this to true.
|
||||
static bool bFakeVMEM = false;
|
||||
|
||||
#ifndef LOGGING
|
||||
#define NOCHECK
|
||||
|
@ -293,7 +294,7 @@ void InitHWMemFuncsWii()
|
|||
|
||||
writeFn32 GetHWWriteFun32(const u32 _Address)
|
||||
{
|
||||
return hwWrite32[(_Address>>HWSHIFT) & (NUMHWMEMFUN-1)];
|
||||
return hwWrite32[(_Address >> HWSHIFT) & (NUMHWMEMFUN-1)];
|
||||
}
|
||||
|
||||
|
||||
|
@ -342,10 +343,18 @@ bool ValidMemory(const u32 _Address)
|
|||
return true;
|
||||
else
|
||||
return false;
|
||||
case 0x7e:
|
||||
case 0x7f:
|
||||
if (bFakeVMEM)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
||||
case 0xE0:
|
||||
if (_Address < (0xE0000000 + L1_CACHE_SIZE))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
case 0xCC:
|
||||
case 0xCD:
|
||||
case 0xC8:
|
||||
|
@ -445,7 +454,7 @@ void CheckForBadAddresses64(u32 Address, u64 Data, bool Read)
|
|||
hwReadWii##_type[(_Address>>HWSHIFT) & (NUMHWMEMFUN-1)](_var, _Address); \
|
||||
else if (((_Address & 0xFFF00000) == 0xCD800000) && \
|
||||
(_Address <= 0xCD809000)) \
|
||||
WII_IOBridge::Read##_type(_var,_Address); \
|
||||
WII_IOBridge::Read##_type(_var, _Address); \
|
||||
else \
|
||||
{ \
|
||||
/* Disabled because the debugger makes trouble with */ \
|
||||
|
@ -467,7 +476,7 @@ void CheckForBadAddresses64(u32 Address, u64 Data, bool Read)
|
|||
PanicAlert("READ: Invalid address: %08x", _Address); \
|
||||
else \
|
||||
{ \
|
||||
if (bFakeVMEM && (_Address & 0xFE000000) == 0x7e000000) \
|
||||
if (bFakeVMEM && ((_Address & 0xFE000000) == 0x7e000000) ) \
|
||||
{ \
|
||||
_var = bswap((*(u##_type*)&m_pFakeVMEM[_Address & FAKEVMEM_MASK])); \
|
||||
} \
|
||||
|
@ -514,16 +523,6 @@ void CheckForBadAddresses64(u32 Address, u64 Data, bool Read)
|
|||
_dbg_assert_msg_(MEMMAP,0,"Memory - Unknown HW address %08x", _Address); \
|
||||
} \
|
||||
} \
|
||||
else if ((_Address >= 0xE0000000) && (_Address < (0xE0000000+L1_CACHE_SIZE))) \
|
||||
{ \
|
||||
*(u##_type*)&m_pL1Cache[_Address & L1_CACHE_MASK] = bswap(_Data); \
|
||||
return; \
|
||||
} \
|
||||
else if (_Address >= 0xE0000000) \
|
||||
{ \
|
||||
LOG(MEMMAP,"WRITE: Cache address out of bounds (addr: %08x data: %08x)",_Address,_Data); \
|
||||
/* PanicAlert("WRITE: Cache address %08x out of bounds", _Address); */ \
|
||||
} \
|
||||
else if (((_Address & 0xF0000000) == 0x80000000) || \
|
||||
((_Address & 0xF0000000) == 0xC0000000) || \
|
||||
((_Address & 0xF0000000) == 0x00000000)) \
|
||||
|
@ -538,9 +537,19 @@ void CheckForBadAddresses64(u32 Address, u64 Data, bool Read)
|
|||
*(u##_type*)&m_pEXRAM[_Address & EXRAM_MASK] = bswap(_Data); \
|
||||
return; \
|
||||
} \
|
||||
else if ((_Address >= 0xE0000000) && (_Address < (0xE0000000+L1_CACHE_SIZE))) \
|
||||
{ \
|
||||
*(u##_type*)&m_pL1Cache[_Address & L1_CACHE_MASK] = bswap(_Data); \
|
||||
return; \
|
||||
} \
|
||||
else if (_Address >= 0xE0000000) \
|
||||
{ \
|
||||
LOG(MEMMAP,"WRITE: Cache address out of bounds (addr: %08x data: %08x)",_Address,_Data); \
|
||||
/* PanicAlert("WRITE: Cache address %08x out of bounds", _Address); */ \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
if (bFakeVMEM && (_Address & 0xFE000000) == 0x7e000000) \
|
||||
if (bFakeVMEM && ((_Address & 0xFE000000) == 0x7e000000)) \
|
||||
{ \
|
||||
*(u##_type*)&m_pFakeVMEM[_Address & FAKEVMEM_MASK] = bswap(_Data); \
|
||||
return; \
|
||||
|
@ -564,6 +573,7 @@ bool IsInitialized()
|
|||
bool Init()
|
||||
{
|
||||
bool wii = Core::GetStartupParameter().bWii;
|
||||
bFakeVMEM = Core::GetStartupParameter().iTLBHack == 1;
|
||||
|
||||
int totalMemSize = RAM_SIZE + EFB_SIZE + L1_CACHE_SIZE + IO_SIZE;
|
||||
if (bFakeVMEM)
|
||||
|
@ -1027,7 +1037,7 @@ u8 *GetPointer(const u32 _Address)
|
|||
case 0x81:
|
||||
case 0xC0:
|
||||
case 0xC1:
|
||||
return (u8*)(((char*)m_pRAM) + (_Address&RAM_MASK));
|
||||
return (u8*)(((char*)m_pRAM) + (_Address & RAM_MASK));
|
||||
|
||||
case 0x10:
|
||||
case 0x11:
|
||||
|
@ -1042,20 +1052,25 @@ u8 *GetPointer(const u32 _Address)
|
|||
case 0xD2:
|
||||
case 0xD3:
|
||||
if (Core::GetStartupParameter().bWii)
|
||||
return (u8*)(((char*)m_pEXRAM) + (_Address&EXRAM_MASK));
|
||||
return (u8*)(((char*)m_pEXRAM) + (_Address & EXRAM_MASK));
|
||||
else
|
||||
return 0;
|
||||
|
||||
case 0xE0:
|
||||
if (_Address < (0xE0000000 + L1_CACHE_SIZE))
|
||||
return GetCachePtr() + (_Address & L1_CACHE_MASK);
|
||||
else
|
||||
return 0;
|
||||
|
||||
case 0xC8:
|
||||
return m_pEFB + (_Address & 0xFFFFFF);
|
||||
case 0xCC:
|
||||
case 0xCD:
|
||||
_dbg_assert_msg_(MEMMAP, 0,"Memory", "GetPointer from IO Bridge doesnt work");
|
||||
_dbg_assert_msg_(MEMMAP, 0, "Memory", "GetPointer from IO Bridge doesnt work");
|
||||
return NULL;
|
||||
default:
|
||||
PanicAlert("Tried to get pointer for unknown address %08x", _Address);
|
||||
break;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1083,6 +1098,12 @@ bool IsRAMAddress(const u32 addr, bool allow_locked_cache)
|
|||
return true;
|
||||
else
|
||||
return false;
|
||||
case 0x7C:
|
||||
if (bFakeVMEM && addr >= 0x7e000000)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -63,17 +63,22 @@ LONG NTAPI Handler(PEXCEPTION_POINTERS pPtrs)
|
|||
|
||||
//Figure out what address was hit
|
||||
u64 badAddress = (u64)pPtrs->ExceptionRecord->ExceptionInformation[1];
|
||||
|
||||
//TODO: First examine the address, make sure it's within the emulated memory space
|
||||
u64 memspaceBottom = (u64)Memory::base;
|
||||
if (badAddress < memspaceBottom) {
|
||||
PanicAlert("Exception handler - access below memory space. %08x%08x",
|
||||
#ifdef _M_X64
|
||||
u64 memspaceTop = memspaceBottom + 0x100000000ULL;
|
||||
#else
|
||||
u64 memspaceTop = memspaceBottom + 0x40000000;
|
||||
#endif
|
||||
if (badAddress < memspaceBottom || badAddress >= memspaceTop) {
|
||||
PanicAlert("Exception handler - access outside memory space. %08x%08x",
|
||||
badAddress >> 32, badAddress);
|
||||
}
|
||||
|
||||
u32 emAddress = (u32)(badAddress - memspaceBottom);
|
||||
|
||||
//Now we have the emulated address.
|
||||
//Let's notify everyone who wants to be notified
|
||||
//Notify(emAddress, accessType == 0 ? Read : Write);
|
||||
|
||||
CONTEXT *ctx = pPtrs->ContextRecord;
|
||||
//opportunity to play with the context - we can change the debug regs!
|
||||
|
@ -82,8 +87,7 @@ LONG NTAPI Handler(PEXCEPTION_POINTERS pPtrs)
|
|||
//execution resources. Instead, we backpatch into a generic memory call and retry.
|
||||
u8 *new_rip = Jit64::BackPatch(codePtr, accessType, emAddress, ctx);
|
||||
|
||||
// We no longer touch Rip, since we return back to the instruction, after overwriting it with a
|
||||
// trampoline jump and some nops
|
||||
// Rip/Eip needs to be updated.
|
||||
if (new_rip)
|
||||
#ifdef _M_X64
|
||||
ctx->Rip = (DWORD_PTR)new_rip;
|
||||
|
|
|
@ -106,6 +106,7 @@ u8 *BackPatch(u8 *codePtr, int accessType, u32 emAddress, CONTEXT *ctx)
|
|||
{
|
||||
// It's a read. Easy.
|
||||
ABI_PushAllCallerSavedRegsAndAdjustStack();
|
||||
if (addrReg != ABI_PARAM1)
|
||||
MOV(32, R(ABI_PARAM1), R((X64Reg)addrReg));
|
||||
if (info.displacement) {
|
||||
ADD(32, R(ABI_PARAM1), Imm32(info.displacement));
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
namespace Jit64 {
|
||||
// Returns the new RIP value
|
||||
u8 *BackPatch(u8 *codePtr, int accessType, u32 emAddress, CONTEXT *ctx);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
||||
|
|
|
@ -921,6 +921,58 @@
|
|||
RelativePath=".\src\main.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Src\MainNoGUI.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="DebugFast|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="DebugFast|x64"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\readme.txt"
|
||||
>
|
||||
|
|
|
@ -123,7 +123,7 @@ bool BootCore(const std::string& _rFilename)
|
|||
ini.Get("Core", "UseDualCore", &StartUp.bUseDualCore, StartUp.bUseDualCore);
|
||||
ini.Get("Core", "SkipIdle", &StartUp.bSkipIdle, StartUp.bSkipIdle);
|
||||
ini.Get("Core", "OptimizeQuantizers", &StartUp.bOptimizeQuantizers, StartUp.bOptimizeQuantizers);
|
||||
|
||||
ini.Get("Core", "TLBHack", &StartUp.iTLBHack, StartUp.iTLBHack);
|
||||
|
||||
// ------------------------------------------------
|
||||
// Update SYSCONF with game specific settings
|
||||
|
@ -194,7 +194,7 @@ bool BootCore(const std::string& _rFilename)
|
|||
if (!Core::Init(StartUp))
|
||||
{
|
||||
PanicAlert("Couldn't init the core.\nCheck your configuration.");
|
||||
return(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
|
@ -204,13 +204,12 @@ bool BootCore(const std::string& _rFilename)
|
|||
#else
|
||||
Core::SetState(Core::CORE_RUN);
|
||||
#endif
|
||||
return(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Stop()
|
||||
{
|
||||
Core::Stop();
|
||||
}
|
||||
} // namespace
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -390,7 +390,7 @@ PC_TexFormat TexDecoder_Decode(u8 *dst, const u8 *src, int width, int height, in
|
|||
#if (defined(_WIN32) || (defined (_M_X64) && !defined(_WIN32)))
|
||||
__m128i Lmask = _mm_set1_epi8 (0x0F);
|
||||
__m128i Hmask = _mm_set1_epi8 (0xF0);
|
||||
__m128i* sseSrc = (__m128i *)src;
|
||||
const __m128i* sseSrc = (const __m128i *)src;
|
||||
__m128i* sseDst = (__m128i *)dst;
|
||||
for (int y = 0; y < height; y += 8)
|
||||
for (int x = 0; x < width; x += 8)
|
||||
|
|
|
@ -55,7 +55,6 @@
|
|||
AssemblerListingLocation="$(IntDir)\"
|
||||
WarningLevel="3"
|
||||
WarnAsError="false"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
ForcedIncludeFiles="stdafx.h"
|
||||
/>
|
||||
|
@ -141,7 +140,6 @@
|
|||
AssemblerListingLocation="$(IntDir)\"
|
||||
WarningLevel="3"
|
||||
WarnAsError="false"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
ForcedIncludeFiles="stdafx.h"
|
||||
/>
|
||||
|
@ -230,7 +228,6 @@
|
|||
AssemblerListingLocation="$(IntDir)\"
|
||||
WarningLevel="3"
|
||||
WarnAsError="false"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
ForcedIncludeFiles="stdafx.h"
|
||||
/>
|
||||
|
@ -320,7 +317,6 @@
|
|||
AssemblerListingLocation="$(IntDir)\"
|
||||
WarningLevel="3"
|
||||
WarnAsError="false"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
ForcedIncludeFiles="stdafx.h"
|
||||
/>
|
||||
|
@ -410,7 +406,6 @@
|
|||
AssemblerListingLocation="$(IntDir)\"
|
||||
WarningLevel="3"
|
||||
WarnAsError="false"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
ForcedIncludeFiles="stdafx.h"
|
||||
/>
|
||||
|
@ -500,7 +495,6 @@
|
|||
AssemblerListingLocation="$(IntDir)\"
|
||||
WarningLevel="3"
|
||||
WarnAsError="false"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
ForcedIncludeFiles="stdafx.h"
|
||||
/>
|
||||
|
|
Loading…
Reference in New Issue