17 May 2015, 12:00 | #1 |
68k
Join Date: Sep 2005
Location: Somewhere
Posts: 829
|
gfxbase negative offset
I have problem with finding out where point this offset, mean
Code:
;d0 - point to gfxBase (just after opening graphics.library) move.l d0,a0 move.l (-$130,a0),a0 ;!!! a0 = ??? move.l (-4,a0),d0 ;!!! d0 = ??? |
17 May 2015, 13:15 | #2 |
2 contact me: email only!
Join Date: May 2001
Location: Auckland / New Zealand
Posts: 3,188
|
The standard Amiga libraries all use a table of 6 bytes for all functions, a jmp ($4ef9) followed by the address of the function.
I'd say this code is looking for the _LVORectFill routine (based on lvo/graphics.i): Code:
GfxBase-$132: jmp _LVORectFill ;GfxBase-$130 is the _LVORectFill pointer |
17 May 2015, 13:29 | #3 |
68k
Join Date: Sep 2005
Location: Somewhere
Posts: 829
|
Ahhh.... right. Thank you.
Not game but util from aminet (2b_RemIBorder) which should remove border from icons. But this util doesn't work on my A600 2mb chip with kick 37.350 wb 38.36. Also I checked other utils like noiconborder (doesn't work too) and NoFillNoDraw (shows guru). So I decide to check what is inside of these utils and I started with 2b_RemIBorder. |
17 May 2015, 15:12 | #4 |
Zone Friend
Join Date: May 2006
Location: France
Posts: 1,889
|
@Asman
I'm the author of NoFill/Nodraw, it was the first to remove borders...clone followed. Back then I only had an A500 with WB 2 so it should work on a plain A600. I didn't wrote it to work with CPU higher than 68000 and seeing all the clones done I didn't pursue the development any further. I could try to make a WinUAE conf like yours to try if it crash or not. Kamelito |
17 May 2015, 16:35 | #5 | |
Banned
Join Date: Jan 2010
Location: Kansas
Posts: 1,284
|
Quote:
|
|
17 May 2015, 17:09 | #6 |
68k
Join Date: Sep 2005
Location: Somewhere
Posts: 829
|
@kamelito
The problem was with following instruction bxx.l which are exists on 68020+. I changed it to bxx.s and now NoDraw works (but of course I click ResetWB to see effect ). Also I see that for example dos.library is closed twice. So that would be very nice if you can post sources to Your closed projects like this then I see possibility to improve them. If you don't mind I will spend some time on NoDraw util to optimize some things. |
17 May 2015, 18:09 | #7 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,351
|
I haven't looked at the code, but its own patch may have a signature cookie longword before the new function code. The program would check for that before trying to install or remove its patch.
|
17 May 2015, 20:40 | #8 | |
Zone Friend
Join Date: May 2006
Location: France
Posts: 1,889
|
Quote:
I put the binary and source code to the zone for U. IIRC it's the same version available on Aminet. Didn't check the code so if something is missing ping me. Regards Kamelito PS You're lucky since it was lost and I partially recovered my A3000 HD and the source was there with 2 others software from a friend of mine. One being a resource tracker which try to free resources when a task crash. I also have OCB but this I can't release without authors permission. Last edited by kamelito; 17 May 2015 at 20:45. |
|
17 May 2015, 20:53 | #9 |
68k
Join Date: Sep 2005
Location: Somewhere
Posts: 829
|
@kamelito
Thanks a lot for source. And of course I look into code and thing which I don't understand is not commented Code:
;asman: If I understand correctly prg is new Draw (grahpcis routine -246) start address prg cmp.l #$00000008,8(a7) ; ??? can someone explain this beq NoDraw |
17 May 2015, 22:11 | #10 |
Zone Friend
Join Date: May 2006
Location: France
Posts: 1,889
|
@Asman,
Status : whatever you want just don't forget to put my name where it is due. As for can someone explain this is... : This is everything and nothing at the same time. To understand it you need a bit of history. NoFill/NoDraw was uploaded at aminet because a friend of mine like it and thought some other could. It was sitting in my HD a couple of years before being there. History : When Amiga OS 2 launched I didn't like at all the icon's borders so I start investigating of way of removing them. I put some hypothesis like it is drawn, so I start patching draws functions until I found which ones were performed while icons where displayed. Then I wrote down the addresses, I used a developer tools to see who owned those addresses spaces and it was the workbench.library. So I start to see if I could directly patch the wb to remove those ugly borders... I was out of luck because the code was in the middle of the wb and wb was in ROM. So I remove my A590 (lend by a friend) and attached an action replay and I traced the code and did some analysis. Knowing I couldn't patch the ROM, I plan to patch the Draw function instead. The problem is that this function is called by a lot of programs and systems functions. Using the Action Replay I tried to find a way to patch only the Draw calls performed for the icon's border. This is what the "cmp.l #$00000008,8(a7)" is used for, it tell NoDraw that a draw call is used to draw a border around an icon so don't Draw if found. This is all the "magic". This is a bit of a hack but it is quite consistent I think. This is the story, so If you find a program removing the icon borders like this then it is based on my program. Two of them put a greeting for my work while a well known one didn't... Kamelito |
25 May 2015, 16:11 | #11 | |
68k
Join Date: Sep 2005
Location: Somewhere
Posts: 829
|
Quote:
@kamelito First at all. Thanks a lot for sources, explanation, it helps me a lot. So there is changed and optimized version of that patch. Code:
;============================================================================= ; ; Changed and optimized version of NoDraw V1.02 by Kamel Biskri ; ; Thanks and respect going to Kamel Biskri. ; ; Usage: just put in Startup-Sequence after loadwb and before endcli ; or run it when Workbench is loaded and then click on ResetWB ; to see changes. ; ; Util works with kick 2+ ; ; known bugs: util doesn't work before loadwb was called, because there is ; no workbench task (I think!). If you put util into WBStartup drawer then ; it doesn't work too. ; ; code 216 bytes ; exe 252 bytes ; ; asman ;============================================================================= INCDIR includes: IFND EXEC_EXEC_I INCLUDE "exec/exec.i" ENDC IFND LIBRARIES_DOSEXTENS_I INCLUDE "libraries/dosextens.i" ENDC INCLUDE "lvo/exec.i" INCLUDE "lvo/graphics.i" ;============================================================================= SECTION NoDraw,CODE start: ;determine type of start: CLI or WB move.l 4.w,a6 ;get exec base move.l ThisTask(a6),a0 ;get our Process structure moveq #0,d0 ;WBStartup msg tst.l pr_CLI(a0) ;we start from CLI or WB bne.b .storeMsg ;from WB. get the startup msg sended by workbench lea pr_MsgPort(a0),a2 jsr _LVOWaitPort(a6) lea pr_MsgPort(a0),a2 jsr _LVOGetMsg(a6) ;d0 = WBStartup msg .storeMsg move.l d0,d5 ;store it, will be used when ;we return the startup message ;at then end of program ;open graphics library v36 or higher lea gfxName(pc),a1 moveq #36,d0 jsr _LVOOpenLibrary(a6) move.l d0,d7 ;store gfx base beq.b .restoreMsg ;alloc memory for patch (it will be not released) moveq #PATCH_SIZE,d0 moveq #MEMF_PUBLIC,d1 jsr _LVOAllocMem(a6) move.l d0,d6 ;store patch begin place beq.b .closeGfx ;find out workbench task lea workbench(pc),a1 jsr _LVOFindTask(a6) move.l d6,a2 move.l d0,(a2)+ ;store wb task move.l a2,d0 ;d0 = start adress od patch code ;copy only patch code to memory lea patchDraw(pc),a0 moveq #PATCH_CODE/2-1,d1 .loop move.w (a0)+,(a2)+ dbf d1,.loop ;change graphics.library function Draw to relocated patch ;d0 = start adress of relocated patch lea (_LVODraw).w,a0 ;function to patch move.l d7,a1 ;gfx base lib pointer jsr _LVOForbid(a6) jsr _LVOSetFunction(a6) move.l d0,(a2) ;save old draw pointer ;right after patch code ;will be used in patch jsr _LVOPermit(a6) .closeGfx ;close graphics library move.l d7,a1 jsr _LVOCloseLibrary(a6) .restoreMsg move.l d5,d0 ;get WBStartup message beq.b .exit ;prevent before workbench do UnLoadSeg jsr _LVOForbid(a6) ;return the startup message move.l d0,a1 jsr _LVOReplyMsg(a6) .exit: moveq #0,d0 rts ;----------------------------------------------------------------------------- patchDraw: ;magic code to check if border is drawn (respect to Kamel Biskri) cmp.l #8,8(sp) bne.b .draw move.l a0,-(sp) ;check if is it workbench process move.l 4.w,a0 move.l ThisTask(a0),a0 cmp.l patchDraw-4(pc),a0 ;after relocation of patch code ;this point to wb task address move.l (sp)+,a0 ;Condition Code Register is not ;changed in this case :) beq.b .exit ;so we can now decide to jump ;if workbench task trying to ;draw border, otherwise just ;run old draw function .draw move.l oldDrawPtr(pc),-(sp) ;after relocation of code ;old draw pointer will be ;located right after patch code .exit rts oldDrawPtr: ;mandatory label ;patch size is increased by 8 because 4 bytes take wb task address and 4 bytes ;take old Draw function address ; PATCH_CODE equ *-patchDraw PATCH_SIZE equ PATCH_CODE+8 workbench: dc.b 'Workbench',0 gfxName: dc.b 'graphics.library',0 dc.b "$VER: IconNoBorder v1.0",0 Respect. Edit: If there is a bug or something that can be improved then I'm open for any suggestion. |
|
25 May 2015, 21:30 | #12 |
Zone Friend
Join Date: May 2006
Location: France
Posts: 1,889
|
@Asman
Thanks to continue working on it, it's nice to see it alive in 2015. I'm going to download your updated version and give it a go. Kudos Kamelito PS Don't forget Aminet Last edited by kamelito; 25 May 2015 at 21:48. |
25 May 2015, 21:47 | #13 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,595
|
|
26 May 2015, 13:16 | #14 |
Zone Friend
Join Date: May 2006
Location: France
Posts: 1,889
|
@Asman
"Edit: If there is a bug or something that can be improved then I'm open for any suggestion. " -Test if the patched fx is not already patched not only by clone, it could crash if one of the program quit and replace the old pointer while the program that it is pointing to is not there anymore. (low probability) - Test the OS version because IIRC in AmigaOS 3.5 and 3.9 this feature was implemented. -Detect maybe if Magelan or Scalos is not lauched as WB replacement. -Add NoFill to this patch, IIRC my solution was not working in some condition ex: with WB background it was kinda transparent. Kamelito |
28 May 2015, 23:24 | #15 |
68k
Join Date: Sep 2005
Location: Somewhere
Posts: 829
|
@Toni
Thanks a lot, of course there is silly bug, should be Code:
lea pr_MsgPort(a0),a2 move.l a2,a0 jsr _LVOWaitPort(a6) move.l a2,a0 jst _LVOGetMsg(a6) I didn't make any progress (no free time ), but I think that three your points from four should be easy. I don't have knowledge how to detect Scalos or Magelan, because I never used them. Any ideas about it are welcome. And of course thanks for suggestions. respect |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
A negative review of Shadow of the Beast | Fred the Fop | Nostalgia & memories | 76 | 13 June 2015 23:45 |
IGN being negative towards Amiga | Djay | Retrogaming General Discussion | 39 | 08 November 2011 20:26 |
Program Counter with Offset - why? | Jherek Carnelia | Coders. General | 26 | 21 March 2011 10:49 |
WHDLoad - NTSC and screen offset | Anubis | project.WHDLoad | 4 | 27 January 2010 21:20 |
GfxRip Palette and Offset questions | stef80 | project.Sprites | 2 | 06 July 2007 19:59 |
|
|