2024-12-06 04:57 CET

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0004593KarateKid2[WHDLoad Installs Games] slavepublic2021-08-02 22:46
ReporterRadertified 
Assigned ToRadertifiedProject InfoKarate Kid 2 (Microdeal)
http://www.whdload.de/games/KarateKid2.html
 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
Summary0004593: Karate Kid II - Several text problems
DescriptionThis is a copy of the information from EAB forum post: http://eab.abime.net/showthread.php?t=97735

----

This might be because I'm using the slave under emulation, but I get the feeling it's just a slave that needs updating.

Karate Kid II is missing the following:

- The first opening screen (before the loading screen) is not there. This one: https://i.imgur.com/eAXKYAP.png
- Before each level, you're supposed to see the level name. This is missing. Example: https://i.imgur.com/byrfgTF.png
- After each level, you're supposed to see how many bonus points you scored. This is missing. Example: https://i.imgur.com/FDt6Qdi.png
- After the second round of the ice breaking bonus level, you're supposed to see how many points you scored. This is missing. Only the first round is shown. Example: https://i.imgur.com/LSE5McK.png

And one more which I'm not sure is a bug or not.

After the final encounter when you beat Chozen, the drum begins. Regardless of what you do, you will always get the message "JUST IN TIME - YOU SAVED THE DAY", even if you don't do anything.
I tried various ADFs and they do the same thing. I can't recall if my original did that (it's been decades), so I can't say if this is how the game always was, or if it's a bug, but I feel like it should say something else if he ends up punching you before you punch him.

----

I have just tested using WinUAE on an 1200 2mb 68020 config (fully compatible) and I can confirm all of the above still happens, with the exception of the final encounter because I didn't play that far.

Everything in the above screenshots seems to be related to the "text screen" code being skipped too quickly.
Steps To ReproduceAny time a text screen appears (such as before each level) you see it flash very quickly instead of showing it for a short while as it does from floppy.
TagsNo tags attached.
MachineUAE
CPU68020
CPUSpeed14
ChipSetAGA
GFXCardNone
ChipMem2 MB
FastMem0 MB
WorkbenchOS 3.1
KickROM40 - Kick 3.1
KickSoftNone
WHDLoad18.5
imported
Attached Files
  • ? file icon KarateKid2.asm (3,731 bytes) 2020-05-24 01:15 -
    	INCDIR	"Include:"
    	INCLUDE	whdload.i
    
    	IFD BARFLY
    	OUTPUT	"KarateKid2.slave"
    	BOPT	O+				;enable optimizing
    	BOPT	OG+				;enable optimizing
    	BOPT	ODd-				;disable mul optimizing
    	BOPT	ODe-				;disable mul optimizing
    	BOPT	w4-				;disable 64k warnings
    	BOPT	wo-			;disable optimizer warnings
    	SUPER
    	ENDC
    
    _base		SLAVE_HEADER			;ws_Security + ws_ID
    		dc.w	10			;ws_Version
    		dc.w	WHDLF_NoError|WHDLF_EmulTrap|WHDLF_ClearMem
    		dc.l	$80000			;ws_BaseMemSize
    		dc.l	0			;ws_ExecInstall
    		dc.w	_Start-_base		;ws_GameLoader
    		dc.w	0			;ws_CurrentDir
    		dc.w	0			;ws_DontCache
    _keydebug	dc.b	0			;ws_keydebug
    _keyexit	dc.b	$59			;ws_keyexit = F10
    _expmem		dc.l	0			;ws_ExpMem
    		dc.w	_name-_base		;ws_name
    		dc.w	_copy-_base		;ws_copy
    		dc.w	_info-_base		;ws_info
    
    _name		dc.b	"Karate Kid 2",0
    _copy		dc.b	"1987 Microdeal",0
    _info		dc.b	"installed & fixed by Bored Seal",10
    		dc.b	"V1.1 (01-Jul-2006)",0
    		even
    
    _Start		lea	(_resload,pc),a1
    		move.l	a0,(a1)
    		move.l	a0,a2
                    lea     (_tags,pc),a0
                    jsr     (resload_Control,a2)
    
    		lea	$10000,a0
    		move.l	a0,a6
    		moveq	#0,d0
    		move.l	#6*$1400,d1
    		moveq	#1,d2
    		movem.l	a0/d1,-(sp)
    		jsr	(resload_DiskLoad,a2)
    
    		movem.l	(sp)+,a0/d0
    		jsr	(resload_CRC16,a2)
    		cmp.w	#$6a6e,d0		;Chris Vella version
    		bne	Unsupported
    
    		lea	patchlist,a0
    		move.l	a6,a1
    		jsr	resload_Patch(a2)
    
    		jmp	$30(a6)
    
    patchlist	PL_START
    		PL_P	$b0c,Loader
    		PL_R	$c7a		;kill disk operations
    		PL_R	$cd8
    		PL_R	$c40
    		PL_W	$6164,$33c0	;fix modes for snoop
    		PL_W	$6184,$33c0
    		PL_W	$61a4,$33c0
    		PL_W	$61c,$604e	;remove stupid trap handlers
    		PL_PS	$1666,ButtonWait
    
    		; Install trainer if CUSTOM1=1
    		PL_IFC1
    			PL_PS	$812,InstallTrainer
    		PL_ENDIF
    
    		PL_END
    
    Loader		movem.l a0-a2/d0-d3,-(sp)
    		move.w	$432(a5),d2		;disk side
    		addq.w	#1,d2
    
    		move.w	$1a(a5),d0		;offset
    		subq	#1,d0
    MulOffset	mulu.w	#$1400,d0
    
    		move.w	$24(a5),d1		;amount of tracks
    		mulu.w	#$1400,d1
    
    		move.l	$1c(a5),a0		;buffer
    		move.l	(_resload,pc),a2
    		jsr	(resload_DiskLoad,a2)
    		movem.l (sp)+,a0-a2/d0-d3
    		clr.l	d0
    		rts
    
    ButtonWait	movem.l	d0-d7/a0-a6,-(sp)
    		lea	button,a0
    		tst.l	(a0)
    		beq	ButtonPressed
    		lea	$bfe001,a0
    test		btst	#6,(a0)
    		beq	ButtonPressed
    		btst	#7,(a0)
    		bne	test
    ButtonPressed	movem.l	(sp)+,d0-d7/a0-a6
    		rts
    
    InstallTrainer
    		move.b	$bfec01,d0	; Replace overwritten code due to JSR
    		movem.l	d0-d7/a0-a6,-(sp)
    
            ror.b   #1,d0
            not.b   d0
            cmp.b   #$01,d0	; Check for 1 pressed
    		beq		CheckTrainerP1Lives
            cmp.b   #$02,d0	; Check for 2 pressed
    		beq		CheckTrainerP2Lives
            cmp.b   #$21,d0	; Check for S pressed
    		beq		SkipLevel
    
    		bra		ReturnFromTrainer
    CheckTrainerP1Lives
    		lea trainer_lives_p1,a0
    		eor.b	#01,(a0)
    		tst.b	(a0)
    		beq		InstallTrainerP1Lives
    		move.l	#$916d005a,$139d0	; Restore original p1 lives code
    		bra		ReturnFromTrainer
    InstallTrainerP1Lives
    		move.l	#$4e714e71,$139d0	; Install the trainer
    		bra		ReturnFromTrainer
    
    CheckTrainerP2Lives
    		lea trainer_lives_p2,a0
    		eor.b	#01,(a0)
    		tst.b	(a0)
    		beq		InstallTrainerP2Lives
    		move.l	#$916d0058,$138f6	; Restore original p1 lives code
    		bra		ReturnFromTrainer
    InstallTrainerP2Lives
    		move.l	#$4e714e71,$138f6	; Install the trainer
    		bra		ReturnFromTrainer
    
    ; The following does not work on last level
    SkipLevel
    		move.w	#0,$f058	; Set player two's health to 0
    		;move.b	#$19,$f1cf	; Skip Miyagi bonus level - Only works when I manually set it in WinUAE's debugger?! Does not work here.
    		bra		ReturnFromTrainer
    
    ReturnFromTrainer
    		movem.l	(sp)+,d0-d7/a0-a6
    		rts
    
    Unsupported	pea	TDREASON_WRONGVER
    _end		move.l	(_resload,pc),a2
    		jmp	(resload_Abort,a2)
    
    _resload	dc.l    0
    _tags		dc.l	WHDLTAG_BUTTONWAIT_GET
    button		dc.l    0,0
    
    trainer_lives_p1	dc.b 1
    trainer_lives_p2	dc.b 1
    
    ? file icon KarateKid2.asm (3,731 bytes) 2020-05-24 01:15 +
  • ? file icon KarateKid2.slave (604 bytes) 2021-04-05 17:28

-Relationships
+Relationships

-Notes

note ~0008591

Radertified (developer)

Just tried as far back as WHDLoad 10. Same problem with the text.

Tried the original slave (1.0) with both WHDLoad 10 and the latest. Same problem.

Even tried JST with the 1.0 slave and it has the same problem.

note ~0008684

Radertified (developer)

I've uploaded a couple of GIFs demonstrating the issue to https://imgur.com/a/oXJavY2

The top GIF is the ADF version (cr SCA - CRC: 6077DA45). You can see immediately that even during loading, a text screen appears. When you press Fire to start the game, you see a text screen saying "Daniel's First Encounter", etc.

The bottom GIF is the WHDLoad slave. All text screens are pretty non-existent. They flash for a fraction of a second and the game continues. (Empty DBF loop?)

note ~0008836

Radertified (developer)

I decided to look into this.

The game works fine when I comment out the following in the slave and assemble:

        ;PL_R $c7a ;kill disk operations

Of course, then the disk drive gets accessed which is not what's wanted in a slave. However the text screens all come up and work perfectly.

I'm not sure what that RTS does so if anyone has experience with disassembly, that's all that needs to be fixed :)

note ~0008840

Radertified (developer)

I've also gone ahead and written a quick trainer for it when CUSTOM1=1 (no clue how to get this to appear in the WHDLoad splash screen though).

When the trainer is enabled, press key:

1 - toggles player 1 unlimited energy on/off
2 - toggles player 2 unlimited energy on/off
s - skips level - Doesn't skip bonus levels, and buggy on last level

I probably didn't do things correctly in a WHDLoad way because I really don't know how. Example:

move.l #$916d005a,$139d0 ; Restore original p1 lives code

I'm putting the value directly into $139d0 because I know that's where it is in memory, however it should probably be done relative to the base address... no clue how to do that with WHDLoad.

note ~0008856

Radertified (developer)

I figured out what was up with the text. It's a timing issue.

I'm not saying that I can fix it, but I think I might be able to do it myself. I don't know, but I'd like to try even if it takes me really long. I'm the only person that's ever reported this issue both here and on EAB so I don't think time matters. I'd like to learn :)

note ~0009847

StingRay (developer)

Last edited: 2021-04-05 17:29

View 2 revisions

Please try attached slave, I have added delays for the text screens and fixed a few other things.

note ~0010630

Radertified (developer)

Oh darn. I didn't know you were working on this.

I've been working on this again for the last week and am just about finished. Added a bunch of trainers, game fixes, etc. All I have left to do is a high score saver, check if there's any more versions to support, and to do proper testing on different configurations. I was planning on releasing it in the next week or two.

I wish I'd logged in earlier!

note ~0010631

Radertified (developer)

I don't know how to edit my post but I wanted to add that I just tried your updated slave, StingRay. It works, but not entirely. It's missing the score screens after each round.

I've fixed those as well as restoring text before the ice bonus stage (something like "focus your power for effect"), as well as fixing the final encounter text to work properly when you lose. And just a couple of days ago I had already added the button wait for text screens :)

I'll continue mine and finish it off since it seems to have more done. No sense in you wasting your time here. Your expertise can be used on more important games than this!
+Notes

-Issue History
Date Modified Username Field Change
2020-05-02 06:29 Radertified New Issue
2020-05-02 06:58 Radertified Note Added: 0008591
2020-05-12 16:36 Radertified Note Added: 0008684
2020-05-14 22:35 Wepl Project WHDLoad Installs Games => KarateKid2
2020-05-23 07:15 Radertified Note Added: 0008836
2020-05-23 10:04 StingRay Assigned To => StingRay
2020-05-23 10:04 StingRay Status new => assigned
2020-05-24 01:15 Radertified File Added: KarateKid2.asm
2020-05-24 01:15 Radertified Note Added: 0008840
2020-05-28 10:12 Radertified Note Added: 0008856
2021-04-05 17:28 StingRay File Added: KarateKid2.slave
2021-04-05 17:29 StingRay Note Added: 0009847
2021-04-05 17:29 StingRay Note Edited: 0009847 View Revisions
2021-07-27 20:01 Radertified Note Added: 0010630
2021-07-27 20:27 Radertified Note Added: 0010631
2021-08-02 22:46 Radertified Assigned To StingRay => Radertified
2021-08-02 22:46 Radertified Status assigned => resolved
2021-08-02 22:46 Radertified Resolution open => fixed
+Issue History