English Amiga Board


Go Back   English Amiga Board > Other Projects > project.WHDLoad

 
 
Thread Tools
Old 10 January 2016, 13:56   #1
puppe
 
Posts: n/a
Help with creating Slave (for Journey to the center of the earth).

I'm working on a slave for "Journey to the Center of the Earth".

The problem I'm having right now is all paths are hardcoded to df0: in a lot of places in the binary and I was hoping there is a better way than to patch all those places? The game uses a lot of OS calls so I'm using kick13.s.

I tried _dos_assign with df0: but that didn't work. Is there a way to "unassign" it from inside my slave? Or is there another way?

Best regards,

Puppe
 
Old 10 January 2016, 16:31   #2
StingRay
move.l #$c0ff33,throat
 
StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
Just patch Open() in dos.library and skip the first 4 bytes in the file name if they contain "df0:".
StingRay is offline  
Old 10 January 2016, 22:01   #3
puppe
 
Posts: n/a
Clever, I'll try that.
 
Old 12 January 2016, 19:49   #4
Wepl
Moderator
 
Wepl's Avatar
 
Join Date: Nov 2001
Location: Germany
Posts: 866
Quote:
Originally Posted by puppe View Post
I tried _dos_assign with df0: but that didn't work. Is there a way to "unassign" it from inside my slave?
This should work. I assume you didn't use it right.
Wepl is offline  
Old 16 January 2016, 20:08   #5
puppe
 
Posts: n/a
Quote:
Originally Posted by Wepl View Post
This should work. I assume you didn't use it right.
How do I use it? I tried calling it like this first in _cb_dosLoadSeg:
Code:
_cb_dosLoadSeg:
lea     diskname(pc),a0                                                                                                                                   
sub.l   a1,a1                                                                                                                                             
bsr     _dos_assign
with this after .end
Code:
diskname: dc.b "fd0", 0
Then it does'nt seem to start my application

I also tried it in bootearly like this:

Code:
        IFD BOOTEARLY
_bootearly
                ;assigns                                                                                                                                                  
                lea     diskname(pc),a0
                sub.l   a1,a1
                bsr     _dos_assign
                rts
diskname        dc.b    "df0",0
        ENDC
Now the application starts, but can't find it's files.

I managed to patch Open (thanks stingray) by modifying kick13.s and this works. But I guess I should be able to patch it from within my slave, but I can't figure out how to get the address of Open() from within my slave.

Any ideas?

Last edited by puppe; 16 January 2016 at 20:16.
 
Old 16 January 2016, 20:42   #6
Wepl
Moderator
 
Wepl's Avatar
 
Join Date: Nov 2001
Location: Germany
Posts: 866
Quote:
Originally Posted by puppe View Post
How do I use it? I tried calling it like this first in _cb_dosLoadSeg:
Code:
_cb_dosLoadSeg:
lea     diskname(pc),a0                                                                                                                                   
sub.l   a1,a1                                                                                                                                             
bsr     _dos_assign
Why do you do this in _cb_dosLoadSeg?
This makes not much sense because it will add this assign multiple times for every LoadSeg call.
Normally you would use _bootdos which replaces the startup-sequence. In rare cases it may be feasible to use _cb_dosLoadSeg instead if there is a lot of logic in the startup-sequence and you don't want to rebuild that in the Slave. But then you should make sure _dos_assign is called only one time.
Quote:
Originally Posted by puppe View Post
with this after .end
Code:
diskname: dc.b "fd0", 0
Then it does'nt seem to start my application
"fd0"? Is this a typo?
Quote:
Originally Posted by puppe View Post
I also tried it in bootearly like this:

Code:
        IFD BOOTEARLY
_bootearly
                ;assigns                                                                                                                                                  
                lea     diskname(pc),a0
                sub.l   a1,a1
                bsr     _dos_assign
                rts
diskname        dc.b    "df0",0
        ENDC
Now the application starts, but can't find it's files.
_dos_assign cannot work in _bootearly because at this time no dos.library exist. It seems you did not read the kick.readme at least.
Quote:
Originally Posted by puppe View Post
I managed to patch Open (thanks stingray) by modifying kick13.s and this works. But I guess I should be able to patch it from within my slave, but I can't figure out how to get the address of Open() from within my slave.
Modifying kick13.s is a bad idea.
dos.library cannot be patched easily under 1.x because it's written in BCPL and doesn't use a standard jump table.

Try to use _bootdos and _dos_assign. If it doesn't work post your source.
Wepl is offline  
Old 16 January 2016, 20:56   #7
puppe
 
Posts: n/a
Quote:
Originally Posted by Wepl View Post
Why do you do this in _cb_dosLoadSeg?
This makes not much sense because it will add this assign multiple times for every LoadSeg call.
Normally you would use _bootdos which replaces the startup-sequence. In rare cases it may be feasible to use _cb_dosLoadSeg instead if there is a lot of logic in the startup-sequence and you don't want to rebuild that in the Slave. But then you should make sure _dos_assign is called only one time.
Ignorance, I used one of my old slaves that used _cb_dosLoadSeg. I think I also tried to call _dos_assign only once when I found my application in _cb_dosLoadSeg but couldn't get that to work either.

Quote:
Originally Posted by Wepl View Post
"fd0"? Is this a typo?
Yes, it's "df0" in my source file.

Quote:
Originally Posted by Wepl View Post
_dos_assign cannot work in _bootearly because at this time no dos.library exist. It seems you did not read the kick.readme at least.
I must have missed that part I see it clearly now.

Quote:
Originally Posted by Wepl View Post
Modifying kick13.s is a bad idea.
dos.library cannot be patched easily under 1.x because it's written in BCPL and doesn't use a standard jump table.

Try to use _bootdos and _dos_assign. If it doesn't work post your source.
Since my startup-sequence only calls one file, I'll definitely use _bootdos instead. I'll let you know how everything turns out.

Thanks for your help.
 
Old 16 January 2016, 21:16   #8
puppe
 
Posts: n/a
Using _bootdos and _dos_assign (used the kick13.asm example) it now works.

Now on to making the game compatible with whdload.
 
Old 16 January 2016, 21:53   #9
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,200
It is possible to patch 1.3 doslib I ve written a generic macro (see AnotherWorld whdload slave source for full example).


Code:
; A6: DosBase
; you must define your own new_Read or new_Lock and somewhere / in the end you must
; move.l   old_Lock(pc),-(A7)
; rts
; if you want to jump to the old routine

PATCH_DOSLIB_OFFSET:MACRO
	movem.l	d0-d1/a0-a1,-(a7)
	move.l	A6,A1
	add.l	#_LVO\1,A1
	moveq	#0,D0
	move.w	4(A1),D0
	addq.l	#4,D0
	add.l	D0,A1

	lea	old_\1(pc),a0
	move.l	A1,(A0)+

	move.l	A6,A1
	add.l	#_LVO\1,A1
	move.b	1(A1),D0
	ext.w	D0
	ext.l	D0
	move.l	D0,(A0)		; moves to d0_value_xxx

	move.w	#$4EF9,(A1)+	
	pea	new_\1_init(pc)
	move.l	(A7)+,(A1)+
	bra.b	end_patch_\1
new_\1_init
	move.l	d0_value_\1(pc),d0
	bra	new_\1
old_\1:
	dc.l	0
d0_value_\1
	dc.l	0
end_patch_\1:
	movem.l	(a7)+,d0-d1/a0-a1
	ENDM
This ONLY works with doslib on kick 1.x system. patching doslib on 3.1 is easier (like the other libs):

A normal lib patch would look like this

Code:
PATCH_XXXLIB_OFFSET:MACRO
	movem.l	d0-d1/a0-a1,-(a7)
	move.l	A6,A1
	add.l	#_LVO\1,A1
	lea	old_\1(pc),a0
	move.l	2(A1),(A0)
	move.w	#$4EF9,(A1)+	
	pea	new_\1(pc)
	move.l	(A7)+,(A1)+
	bra.b	end_patch_\1
old_\1:
	dc.l	0
end_patch_\1:
	movem.l	(a7)+,d0-d1/a0-a1

	ENDM
(don't forget to flush the caches when all patches are done, those libs tend to be in fastmem!!)

But assigning df0 has always worked. I used the patch

- on a open in write mode to write the final size of the file which avoids flashing
- on a read to patch protections in bytecode (another world, monkey I and i,...)

Last edited by jotd; 16 January 2016 at 22:09.
jotd is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Journey To The Center Of The Earth en ger fr turrican3 Games images which need to be WHDified 0 15 April 2015 02:59
Z-Out with a center Adventec logo Vollldo support.Games 5 06 September 2010 22:36
Automatic center problem bagpipes support.WinUAE 2 20 August 2010 13:02
Anyone seen this? Emu Control Center MrX_Cuci project.GameBase Amiga 83 22 July 2008 22:44

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 02:08.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.07716 seconds with 15 queries