I need help with custom hacks

Discussions about all other tools (CusPop, SAV/HOF editors) and hex editing.
User avatar
Emiliano
Wizard Scribe
Wizard Scribe
Posts: 718
Joined: July 31st, 2019, 8:53 pm
Location: Mexico
Contact:

Re: I need help with custom hacks

Post by Emiliano »

Sorry to disturb again
Since 2016 (when I finished the original game for the first time) I see something that seems unfair to me:
•The prince strikes shadow and loses a life
•The shadow strikes prince and nothing happens
•If one dies, the other will die too
What I want is that the shadow lose a life if he strikes the prince, like what happens by default but reversed; keeping the first and third point, of course
Last edited by Emiliano on August 14th, 2020, 7:46 pm, edited 1 time in total.
65536
User avatar
atrueprincefanfrom18
Site Shah
Site Shah
Posts: 1782
Joined: January 21st, 2020, 2:53 pm
Contact:

Re: I need help with custom hacks

Post by atrueprincefanfrom18 »

In SNES version, if one hit another, both lost their points. I don't know if that's possible in DOSBox, but maybe possible in SDLPoP, but you will have to write the code yourself. I don't think there is any hex code available to change.

I think David is the right person whoc can help you in both of your questions.
Love to create new MODS :)

My complete list of mods until now!

My channel. Do consider subscribing it! :)
User avatar
Emiliano
Wizard Scribe
Wizard Scribe
Posts: 718
Joined: July 31st, 2019, 8:53 pm
Location: Mexico
Contact:

Re: I need help with custom hacks

Post by Emiliano »

atrueprincefanfrom18 wrote: August 14th, 2020, 7:41 pm You will have to write the code yourself. I don't think there is any hex code available to change.
That's the big problem, some programs stop working if you add just a byte between two bytes set correctly
However Hexit has the option to add and remove bytes
65536
User avatar
Emiliano
Wizard Scribe
Wizard Scribe
Posts: 718
Joined: July 31st, 2019, 8:53 pm
Location: Mexico
Contact:

Re: I need help with custom hacks

Post by Emiliano »

atrueprincefanfrom18 wrote: August 14th, 2020, 5:22 am And don't use Jaffar in Room 3 or Room 1 (I don't know really remember what's the condition,
I tested this part and nothing special or interesting happened, it works normally, Jaffar dies and stops time countdown
atrueprincefanfrom18 wrote: August 14th, 2020, 5:22 am Check the special events on PoPOT).
Believe me, I downloaded the latest file and read it completely, it does not say anything about this
65536
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: I need help with custom hacks

Post by David »

Emiliano Fierro wrote: August 14th, 2020, 1:41 am Is it possible to listen the ENDING LEVEL MUSIC at the end of level 13 after killing Jaffar?
Watch the video to understand, I just want to enable the music at the end of level 12b (These hacks are not only removing and disabling)
Enable level ending music on level 13:

Search: 83 3E 9E 0F 0D 74 23
Change: 0D to CC
(offset in unpacked 1.0: 0x88CA)

Details:

Code: Select all

seg006:0366                      not_alt_level_music:
seg006:0366 83 3E 9E 0F 0D                       cmp     current_level, 13 ; level 13 has no ending music ; <-- change 13 to 0xCC (invalid level number)
seg006:036B 74 23                                jz      seq_f6_nop
seg006:036D 83 3E 9E 0F 0F                       cmp     current_level, 15 ; level 15 has no ending music
seg006:0372 74 1C                                jz      seq_f6_nop
Emiliano Fierro wrote: August 14th, 2020, 7:20 pm Since 2016 (when I finished the original game for the first time) I see something that seems unfair to me:
•The prince strikes shadow and loses a life
•The shadow strikes prince and nothing happens
•If one dies, the other will die too
What I want is that the shadow lose a life if he strikes the prince, like what happens by default but reversed; keeping the first and third point, of course
Make both the prince and the shadow lose a HP when either is hurt:

Search: 80 3E 8B 4D 01 75 14 83 3E 9E 0F 0C 75 0D 83 3E 4A 4C 00 74 06 A1 4A 4C A3 F0 5F
Change to: 80 3E 9E 0F 0C 75 14 A1 4A 4C 0B 06 F0 5F 79 0B A3 4A 4C A3 F0 5F 90 90 90 90 90
(offset in unpacked 1.0: 0x2B2B)

Details:

Code: Select all

This part:
seg000:127B             do_delta_hp  proc far
seg000:127B 80 3E 8B 4D 01           cmp     opp.charid, charid_1_shadow
seg000:1280 75 14                    jnz     loc_1296
seg000:1282 83 3E 9E 0F 0C           cmp     current_level, 12 ; level 12: if the shadow is hurt, kid is also hurt
seg000:1287 75 0D                    jnz     loc_1296
seg000:1289 83 3E 4A 4C 00           cmp     guardhp_delta, 0
seg000:128E 74 06                    jz      loc_1296
seg000:1290 A1 4A 4C                 mov     ax, guardhp_delta
seg000:1293 A3 F0 5F                 mov     hitp_delta, ax
seg000:1296          loc_1296:

is changed to this:
(assembled using NASM)
     1                                  current_level equ 0F9Eh
     2                                  guardhp_delta equ 4C4Ah
     3                                  hitp_delta equ 5FF0h
     4
     5                                  org 0
     6
     7 00000000 90<rept>                times 127Bh nop
     8
     9 0000127B 803E9E0F0C              cmp byte [current_level], 12  ; Only on level 12.
    10 00001280 7514                    jne skip  ; (To free some bytes, I removed the opp.charid check, because it's unnecessary: the only opponent on level 12 is the shadow.)
    11
    12 00001282 A14A4C                  mov ax, [guardhp_delta]  ; If either the shadow or the prince lost HP:
    13 00001285 0B06F05F                or  ax, [hitp_delta]
    14
    15 00001289 790B                    jns skip  ; Skip if the someone got *more* HP, for example the prince drank a potion (not strictly necessary).
    16
    17 0000128B A34A4C                  mov [guardhp_delta], ax  ; Apply the same HP change to both the shadow and the prince.
    18 0000128E A3F05F                  mov [hitp_delta], ax
    19
    20 00001291 90<rept>                times ($$+1296h-$) nop
    21                                  skip:
User avatar
Emiliano
Wizard Scribe
Wizard Scribe
Posts: 718
Joined: July 31st, 2019, 8:53 pm
Location: Mexico
Contact:

Re: I need help with custom hacks

Post by Emiliano »

Thanks David :D that's all for now, with level 13 finished I will need another hack
65536
User avatar
atrueprincefanfrom18
Site Shah
Site Shah
Posts: 1782
Joined: January 21st, 2020, 2:53 pm
Contact:

Re: I need help with custom hacks

Post by atrueprincefanfrom18 »

Seriously David, you are an expert in hex editing!
Love to create new MODS :)

My complete list of mods until now!

My channel. Do consider subscribing it! :)
User avatar
Emiliano
Wizard Scribe
Wizard Scribe
Posts: 718
Joined: July 31st, 2019, 8:53 pm
Location: Mexico
Contact:

Re: I need help with custom hacks

Post by Emiliano »

David uses CusAsm to get the Hex codes, it is for reverse engineers and expert users, just look at the BBCodes he gives in most Hex modifications
65536
User avatar
atrueprincefanfrom18
Site Shah
Site Shah
Posts: 1782
Joined: January 21st, 2020, 2:53 pm
Contact:

Re: I need help with custom hacks

Post by atrueprincefanfrom18 »

Hmm, need to look into it :)
Thanks!
Love to create new MODS :)

My complete list of mods until now!

My channel. Do consider subscribing it! :)
User avatar
Emiliano
Wizard Scribe
Wizard Scribe
Posts: 718
Joined: July 31st, 2019, 8:53 pm
Location: Mexico
Contact:

Re: I need help with custom hacks

Post by Emiliano »

Hi again, recently I had a crazy idea which I don't know if it is hard or impossible to do.
Chompers cut from left to right, but how about if they cut from right to left, like in my reversed video.
Is it impossible or is it just hard?
Thanks

This started like a crazy idea, but it would be useful if possible.
65536
User avatar
atrueprincefanfrom18
Site Shah
Site Shah
Posts: 1782
Joined: January 21st, 2020, 2:53 pm
Contact:

Re: I need help with custom hacks

Post by atrueprincefanfrom18 »

Wow! Actually, even I had an idea. Why is it that the chomper is on the left of the tile and the gate is on the right, can we shift them both? Somehow?
Love to create new MODS :)

My complete list of mods until now!

My channel. Do consider subscribing it! :)
User avatar
Emiliano
Wizard Scribe
Wizard Scribe
Posts: 718
Joined: July 31st, 2019, 8:53 pm
Location: Mexico
Contact:

Re: I need help with custom hacks

Post by Emiliano »

atrueprincefanfrom18 wrote: August 19th, 2020, 6:34 am Wow! Actually, even I had an idea. Why is it that the chomper is on the left of the tile and the gate is on the right, can we shift them both? Somehow?
Maybe altering graphics ;)
65536
User avatar
atrueprincefanfrom18
Site Shah
Site Shah
Posts: 1782
Joined: January 21st, 2020, 2:53 pm
Contact:

Re: I need help with custom hacks

Post by atrueprincefanfrom18 »

Emiliano Fierro wrote: August 19th, 2020, 6:40 am Maybe altering graphics ;)
But it won't work like that. It should work like it, not so important to display.
Love to create new MODS :)

My complete list of mods until now!

My channel. Do consider subscribing it! :)
User avatar
Emiliano
Wizard Scribe
Wizard Scribe
Posts: 718
Joined: July 31st, 2019, 8:53 pm
Location: Mexico
Contact:

Re: I need help with custom hacks

Post by Emiliano »

David, Norbert
Do you think this topic and probalby this other one should be merged with the current to get a large topic? Because I posted them separatedly but both with the same purpose as here (customizations), in addition, posts are not very different.
Do what you think better.
Thanks.
65536
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: I need help with custom hacks

Post by David »

Emiliano Fierro wrote: August 19th, 2020, 3:37 am Hi again, recently I had a crazy idea which I don't know if it is hard or impossible to do.
Chompers cut from left to right, but how about if they cut from right to left, like in my reversed video.
Is it impossible or is it just hard?
Thanks

This started like a crazy idea, but it would be useful if possible.
Time taken: about 1 hour.

Search: C7 46 F6 00 00 A0 27 3D 98 8B D8 D1 E3 8B 87 74 22 89 46 F8
Change: BE 00 00 8A 1E 27 3D 30 FF D1 E3 8B 87 74 22 04 09 89 46 F8
(offset in unpacked v1.0: 0xAD2E)

Search: FF 46 F6 FF 46 F8 83 7E F6 0A 7C AE
Change: 46 FF 4E F8 90 90 81 FE 0A 00 7C AE
(offset in unpacked v1.0: 0xAD8A)

Details:

Code: Select all

In start_chompers(), the following code is changed:
seg007:0F2E C7 46 F6 00 00                       mov     [bp+column], 0
seg007:0F33 A0 27 3D                             mov     al, char.curr_row
seg007:0F36 98                                   cbw
seg007:0F37 8B D8                                mov     bx, ax
seg007:0F39 D1 E3                                shl     bx, 1
seg007:0F3B 8B 87 74 22                          mov     ax, tbl_line[bx]
seg007:0F3F 89 46 F8                             mov     [bp+tile], ax
seg007:0F42 EB 4C                                jmp     short loc_94E0
seg007:0F44                      loc_9494:
[...]
seg007:0F8A FF 46 F6                             inc     [bp+column]
seg007:0F8D FF 46 F8                             inc     [bp+tile]
seg007:0F90                      loc_94E0:
seg007:0F90 83 7E F6 0A                          cmp     [bp+column], 10
seg007:0F94 7C AE                                jl      loc_9494

into this:
     1                                  tbl_line equ 2274h
     2                                  tile equ -8
     3                                  ;column equ si ; I moved this variable from the stack to a register to make the code smaller.
     4                                  char.curr_row equ 3D22h + 5
     5
     6                                  org 0
     7 00000000 00<rept>                times 0F2Eh db 0 ; skip
     8
     9 00000F2E BE0000                  mov si, 0
    10 00000F31 8A1E273D                mov bl, [char.curr_row]
    11 00000F35 30FF                    xor bh, bh
    12
    13 00000F37 D1E3                    shl bx, 1
    14 00000F39 8B877422                mov ax, [tbl_line+bx]
    15 00000F3D 0409                    add al, 9
    16 00000F3F 8946F8                  mov [bp+tile], ax
    17
    18                                  times ($$+0F42h-$) nop ; pad
    19
    20 00000F42 00<rept>                times ($$+0F8Ah-$) db 0 ; skip
    21
    22 00000F8A 46                      inc si
    23 00000F8B FF4EF8                  dec word [bp+tile]
    24
    25 00000F8E 90<rept>                times ($$+0F90h-$) nop ; pad
    26
    27 00000F90 81FE0A00                cmp si, 10
    28 00000F94 7CAE                    jl $$+0F44h
    29                                  times ($$+0F96h-$) nop ; pad
Post Reply