Thread: Emerald Mine II
View Single Post
Old 12 May 2015, 20:43   #13
Registered User
Join Date: Aug 2004
Posts: 3,169
Here are some patches which you can apply to the Emerald Mine II executable. Apart from removing copy-protection you can bypass several non-system-legal routines which could/should allow it to work on accelerated machines.

You can use a binary file editor like Hex to make the changes.

Details of patches to apply to the Emerald Mine II executable
File to alter: "EM2" on disk "Emerald Mine II", dated 02-Aug-88 20:17:38
File length: 32272

["RS off." denotes the offset in the ReSource disassembly]

Remove copy-protection
Offset	RS off.	Change From	Change To
$0AC8	$0AA0	4EBA 522A	4E71 4E71	;JSR (_protec,PC) -> NOP / NOP
$0B3C	$0B14	65		60		;BCS.B .CopyProtectPassed -> BRA.B
$258A	$2562	67		60		;BEQ.B .ProtectionPassed -> BRA.B
$25FA	$25D2	67		60		;BEQ.B .ProtectionPassed0 -> BRA.B
$2BCE	$2BA6	0018 D878 01F2	007B 4E71 4E71	;MOVE.W #$18,D4 / ADD.W ($01F2).W,D4 -> MOVE.W #$7B,D4 / NOP / NOP
$41D4	$41AC	01F4 DE78 01F2	0257 4E71 4E71	;MOVE.W #$1F4,D7 / ADD.W ($01F2).W,D7 -> MOVE.W #$0257,D7 / NOP / NOP

Bypass the title screen music
The music code is not system-friendly and is likely to cause crashes on some
machines. Completely bypassing it does not waste time by loading the "snd"
file, but also means the title screen does not appear for very long.
$01E4	$01BC	4EBA 0E04	4E714E71	;Change JSR (ReadAndDecryptFile,PC) to NOP / NOP
$0262	$023A	6104		4E71		;Change BSR.B .PlayMusic to NOP

Remove illegal code to close the first window
The game contains code to close the first window on the first screen. That is
not system-legal and may cause crashes.
Offset	RS off.	Change From	Change To
$0138	$0110	2F29 0004	4E71 4E71	;NOP out MOVE.L (sc_FirstWindow,A1),-(SP)
$013C	$0114	4EBA 7730	4E71 4E71	;NOP out JSR (_CloseWindow,PC)
$0140	$0118	584F		4E71		;NOP out ADDQ.W #4,SP

Fix DMACON bug
This fixes a bug caused by a typo in the source code: #8200 was used instead
of #$8200 for writing to DMACON. That bug may have caused crashes.
$2300	$22D8	2008		8200

Display mode-detection
The display mode-detection routine is bugged, having problems on fast CPUs.
This is not a proper fix, just patch to always assume PAL or always NTSC
according to your preference.
$229C	$2274	67		60	;Always assume PAL. BEQ.B .PALMachine -> BRA.B
  -- OR --
$229C	$2274	6760		4E71	;Always assume NTSC. BEQ.B .PALMachine -> NOP

Other patches
Fix a small bug which probably doesn't cause a problem in practice:
$225B	$2233	64		63	;Fix one-too-large DBF loop counter

Change several reads of $BFE0FF to $BFE001. This is unlikely to cause problems
in practice though.
$2A9D	$2A75	FF		01
$2B4F	$2B27	FF		01
$4D6B	$4D43	FF		01
$4D7D	$4D55	FF		01
$6635	$660D	FF		01

Fix a bug which may (by good fortune) not actually be a problem.
$5A53	$5A2B	0E		06	;Always restore registers in StopWheelTurning routine

There is a bug in the game which uses $3BA.W for two different purposes. It
contains the points awarded for stoning a Flyer, but is also used in the
HandlePlayerDeathOrExit routine. The patched version of the "release 2"
executable done by No One Inc. in 1993 (comment "NOI&RIS version! v1.00")
changes references to $3BA in the HandlePlayerDeathOrExit routine to use $3EA,
an address which appears to be otherwise unused. This is an analogous patch
for Emerald Mine II.
$5467	$543F	BA		EA
$5513	$54EB	BA		EA
$5549	$5521	BA		EA
mark_k is offline  
Page generated in 0.04615 seconds with 11 queries