Archive for the 'asm' Category

25
Apr
09

[ASM] Minesweeper God Mode Testing III

Fixed the timer now so that it only stops working if you have won the game.
Original
#########################

0100347C w>    8325 64510001 00                AND DWORD PTR DS:[fTimer],0
01003483   |.  56                              PUSH ESI
01003484       8B7424 08                       MOV ESI,DWORD PTR SS:[ESP+8]

#########################
With Jump
#########################

0100347C w>   /E9 0E160000                     JMP winmine.01004A8F
01003481      |90                              NOP
01003482      |90                              NOP
01003483   |. |56                              PUSH ESI
01003484      |8B7424 08                       MOV ESI,DWORD PTR SS:[ESP+8]

#########################
Code Cave
#########################

01004A8F    > \83F8 01                         CMP EAX,1
01004A92    .^ 0F84 EBE9FFFF                   JE winmine.01003483
01004A98    .  8325 64510001 00                AND DWORD PTR DS:[fTimer],0
01004A9F    .^ E9 DFE9FFFF                     JMP winmine.01003483
Advertisements
25
Apr
09

[ASM] Minesweeper God Mode Testing II

Ok after playing around a bit more, i’veĀ  set it up so that after you die, you have the default smiley icon not the dead one:
Original
#########################

0100348C   |.  0F95C0            SETNE AL
0100348F       40                INC EAX
01003490       40                INC EAX
01003491       50                PUSH EAX
01003492       A3 60510001       MOV DWORD PTR DS:[iButtonCur],EAX
01003497       E8 77F4FFFF       CALL winmine.DisplayButton
0100349C       33C0              XOR EAX,EAX

#########################
With Jump
#########################

0100348C   |.  0F95C0            SETNE AL
0100348F       E9 E6150000       JMP winmine.01004A7A
01003494       90                NOP
01003495       90                NOP
01003496       90                NOP
01003497       E8 77F4FFFF       CALL winmine.DisplayButton
0100349C       33C0              XOR EAX,EAX

#########################
Code Cave
#########################

01004A7A       83F8 01           CMP EAX,1
01004A7D       75 05             JNZ SHORT winmine.01004A84
01004A7F       B8 03000000       MOV EAX,3
01004A84       50                PUSH EAX
01004A85       A3 60510001       MOV DWORD PTR DS:[iButtonCur],EAX
01004A8A     ^ E9 08EAFFFF       JMP winmine.01003497
25
Apr
09

[ASM] Minesweeper God Mode Testing

UPDATED [At End]

Got bored and trying to create an effective god mode in Minesweeper that will allow you to keep on playing even after you die.
If I can get it all to work properly, I may make a small hack of the game that allows you to set a number of lives per game, and then you loose after hitting that many mines.

Ill be updating the blog with posts as I research more.
This is what I have so far.
__________________________________
Pretty much everything of use so far has come from the GameOver function called here:

010035AB   |> \E8 CCFEFFFF       CALL winmine.GameOver        ; (CALL winmine.0100347C)

After a bit of playing around, ive created a cave that allows me to continue playing even after hitting a mine:
Original
#########################

010034D4       85F6                       TEST ESI,ESI
010034D6       C705 00500001 10000000     MOV DWORD PTR DS:[fStatus],10
010034E0       5E                         POP ESI

#########################
With Jump
#########################

010034D4   |.  85F6              TEST ESI,ESI
010034D6       E9 B4150000       JMP winmine.01004A8A
010034DB       90                NOP
010034DC       90                NOP
010034DD       90                NOP
010034DE       90                NOP
010034DF       90                NOP
010034E0   |.  5E                POP ESI

#########################
Code Cave
#########################

01004A8A       833D 60510001 03           CMP DWORD PTR DS:[iButtonCur],3
01004A91       5E                         POP ESI
01004A92     ^ 0F85 77EAFFFF              JNZ winmine.0100350F
01004A98       C705 00500001 10000000     MOV DWORD PTR DS:[fStatus],10
01004AA2     ^ E9 3CEAFFFF                JMP winmine.010034E3

This little cave just checks to see if the game has been won or lost. If its been won, then it sets the gamestate to 0x10 (Game Over) else, it keeps the value as 0 and returns to the function.

__________________________________
Update:
I decided that instead of using a cave, just patching the function would work just as nicely:
Original
#########################

010034CF   |.  E8 19040000                CALL winmine.PlayTune
010034D4       85F6                       TEST ESI,ESI
010034D6       C705 00500001 10000000     MOV DWORD PTR DS:[fStatus],10
010034E0       5E                         POP ESI
010034E1       74 2C                      JE SHORT winmine.0100350F
010034E3       66:A1 A0560001             MOV AX,WORD PTR DS:[Preferences]
010034E9       66:3D 0300                 CMP AX,3
010034ED       74 20                      JE SHORT winmine.0100350F
010034EF       8B0D 9C570001              MOV ECX,DWORD PTR DS:[cSec]

#############
PATCHED
#############

010034CF   |.  E8 19040000                CALL winmine.PlayTune
010034D4       66:A1 A0560001             MOV AX,WORD PTR DS:[Preferences]
010034DA       833D 60510001 03           CMP DWORD PTR DS:[iButtonCur],3
010034E1       5E                         POP ESI
010034E2       75 2B                      JNZ SHORT winmine.0100350F
010034E4       C705 00500001 10000000     MOV DWORD PTR DS:[fStatus],10
010034EE       90                         NOP
010034EF       8B0D 9C570001              MOV ECX,DWORD PTR DS:[cSec]