diff --git a/src/ARMeilleure/Translation/PTC/Ptc.cs b/src/ARMeilleure/Translation/PTC/Ptc.cs index b3baa4413..72f9d5a0a 100644 --- a/src/ARMeilleure/Translation/PTC/Ptc.cs +++ b/src/ARMeilleure/Translation/PTC/Ptc.cs @@ -33,7 +33,7 @@ namespace ARMeilleure.Translation.PTC private const string OuterHeaderMagicString = "PTCohd\0\0"; private const string InnerHeaderMagicString = "PTCihd\0\0"; - private const uint InternalVersion = 7007; //! To be incremented manually for each change to the ARMeilleure project. + private const uint InternalVersion = 7008; //! To be incremented manually for each change to the ARMeilleure project. private const string ActualDir = "0"; private const string BackupDir = "1"; @@ -873,7 +873,7 @@ namespace ARMeilleure.Translation.PTC Debug.Assert(Profiler.IsAddressInStaticCodeRange(address)); - TranslatedFunction func = translator.Translate(address, executionMode, highCq); + TranslatedFunction func = translator.Translate(address, executionMode, highCq, pptcTranslation: true); if (func == null) { diff --git a/src/ARMeilleure/Translation/Translator.cs b/src/ARMeilleure/Translation/Translator.cs index 14c80f24b..d8528cfd6 100644 --- a/src/ARMeilleure/Translation/Translator.cs +++ b/src/ARMeilleure/Translation/Translator.cs @@ -219,7 +219,7 @@ namespace ARMeilleure.Translation } } - internal TranslatedFunction Translate(ulong address, ExecutionMode mode, bool highCq, bool singleStep = false) + internal TranslatedFunction Translate(ulong address, ExecutionMode mode, bool highCq, bool singleStep = false, bool pptcTranslation = false) { ArmEmitterContext context = new( Memory, @@ -246,7 +246,7 @@ namespace ARMeilleure.Translation context.Branch(context.GetLabel(address)); } - ControlFlowGraph cfg = EmitAndGetCFG(context, blocks, out Range funcRange, out Counter counter); + ControlFlowGraph cfg = EmitAndGetCFG(context, blocks, out Range funcRange, out Counter counter, pptcTranslation); if (cfg == null) { @@ -326,7 +326,8 @@ namespace ARMeilleure.Translation ArmEmitterContext context, Block[] blocks, out Range range, - out Counter counter) + out Counter counter, + bool pptcTranslation) { counter = null; @@ -411,7 +412,10 @@ namespace ARMeilleure.Translation if (opCode.Instruction.Emitter != null) { opCode.Instruction.Emitter(context); - if (opCode.Instruction.Name == InstName.Und && blkIndex == 0) + // if we're pre-compiling PPTC functions, and we hit an Undefined instruction as the first + // instruction in the block, mark the function as blacklisted + // this way, we don't pre-compile Exlaunch hooks, which allows ExeFS mods to run with PPTC + if (pptcTranslation && opCode.Instruction.Name == InstName.Und && blkIndex == 0) { range = new Range(rangeStart, rangeEnd); return null;