diff --git a/src/ARMeilleure/Translation/PTC/Ptc.cs b/src/ARMeilleure/Translation/PTC/Ptc.cs index 5ac29457c..755a69518 100644 --- a/src/ARMeilleure/Translation/PTC/Ptc.cs +++ b/src/ARMeilleure/Translation/PTC/Ptc.cs @@ -29,8 +29,8 @@ namespace ARMeilleure.Translation.PTC { private const string OuterHeaderMagicString = "PTCohd\0\0"; private const string InnerHeaderMagicString = "PTCihd\0\0"; - - private const uint InternalVersion = 6998; //! 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"; @@ -870,7 +870,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 59f1b8665..4eb4dd69a 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) { var context = new ArmEmitterContext( 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;