Jump to content

[SA] Cleo. Crash on 0D46


vladvo

Recommended Posts

Making a cellphone mod. So far so good, but a bug just popped out. 

Start the game, load a save - everything is fine. The mod is working. Then I load a save again and upon activation of mod - crash.
 

:Load_txd_phone
0D42: load_txd "phone" from "MODELS\TXD\PHONE.TXD" // IF and SET      
03F0: enable_text_draw 1
03E3: set_texture_to_be_drawn_antialiased 1
0D43: 8@ = txd "phone" id
0D46: 4@ = find_texture "phone" in_dictionary 8@ // IF and SET
:Load_txd_screen
0AD3: string_format 10@s format "%d" 31@
0D42: load_txd 10@s from "MODELS\TXD\PHONE.TXD" // IF and SET      
0D43: 8@ = txd 10@s id
0D46: 5@ = find_texture 10@s in_dictionary 8@ // IF and SET

I just can't see a good reason for this crash. Everything is working fine on the first load.

 

Scrlog:
 

Spoiler

00000186&0: [0AD3] STRING_FORMAT l10(52)  "%d" 3
00000199&0: [0D42] COMMAND_0D42 "3" "MODELS\TXD\PHONE.TXD"    // TRUE
00000226&1: [0D43] COMMAND_0D43 "3" -> 3705
00000234&1: [0D46] COMMAND_0D46 "3" 3705

*********************************
> Logging finished: 02:42:31
  Powered by SCRLog (by LINK/2012)
  GTA:VC JP support by lazyuselessman
  Improvements by Junior_Djjr
*********************************

Crashinfo:
 

Spoiler

Error: 0x007F39FB
Problem 1: You have an .img file open.
Solution 1: Close it.
Problem 2: Loading a texture (inside TXD). Apparently an original ModLoader bug having a hud.txd installed on it. It can happen when starting the game, and next time it works.
Solution 2: Delete all hud.txd that are installed inside ModLoader. If you have more than 1, try to uninstall and leave only 1 of them.
Problem 3: Failed to load any clothing .txd or vehicle.txd. Or else some paintjob from a car.
Problem 4: Some CLEO script tried to load a sprite texture into some .txd ("models/txd") but didn't load the .txd file before. For example in an old version of ATP.
Solution 4: Identify the mod CLEO, note that the .txd file may even exist (if the .txd file does not exist but CLEO tries to load, the problem is another one), the problem may be directly as an error of some CLEO mod that need .txd but forgot to load it.
About: It could be anything related to "loading a texture from a .txd file", so it could be caused by hundreds of different reasons, but one thing is certain: There's some .txd wrong there, possibly buggy or missing some important texture, things like that.


!!! Google Translated !!!

        GTA SA 1.0.0.0 US
Unhandled exception at 0x007F39FB in gta_sa.exe (+0x3f39fb): 0xC0000005: Access violation reading location 0x00000008.
    Register dump:
        EAX: 0x00000008  EBX: 0x00000001  ECX: 0x079594A8  EDX: 0x0028F5B0  
        EDI: 0x73D37BF0  ESI: 0x01928CD0  EBP: 0x0028F614  EIP: 0x007F39FB  
        ESP: 0x0028F58C  EFL: 0x00210202  CS: 0x00000023   SS: 0x0000002B   
        GS: 0x0000002B   FS: 0x00000053   ES: 0x0000002B   DS: 0x0000002B   
        
    Stack dump:
        0x0028F58C:  73D37BF0 01928CD0 0028F614 00000001 73AD62BD 00000000
        0x0028F5A4:  0028F5B0 01928B78 01928CD0 00000032 00000000 00000000
        0x0028F5BC:  00000000 00000000 00000000 00000000 00000000 00000000
        0x0028F5D4:  00000000 00000000 00000000 00000000 00000000 00000000
        0x0028F5EC:  00000000 00000000 00000000 00000000 00000000 00000000
        0x0028F604:  00000000 00000000 00000000 00000000 0028F668 00469FF7
        0x0028F61C:  01928CD0 01928CD0 00000000 73D3ECC3 01928CD0 0046A220
        0x0028F634:  73AF21CC 04362C34 0028F668 04362C34 00000025 097D0D2F
        0x0028F64C:  006819EE 0000052F 73ADB2AF 00000000 00000000 FFFFFFFF
        0x0028F664:  0028F6D8 0028F69C 0053BFCC 04654F70 0028F71C FFFFFFFF
        base: 0x00090000   top: 0x0028F58C   bottom: 0x00290000
        
    Backtrace (may be wrong):
        =>0x007F39FB _RwTexDictionaryFindNamedTexture+0xb in gta_sa.exe (+0x3f39fb) (0x0028F614) 
          0x00469FF7 _ZN14CRunningScript7ProcessEv+0xf7 in gta_sa.exe (+0x69ff7) (0x0028F668) 
          0x0053BFCC _ZN5CGame7ProcessEv+0xec in gta_sa.exe (+0x13bfcc) (0x0028F69C) 
          0x705CB8E9 in modloader.asi (+0x1b8e9) (0x0028F6E4) 
          0x705CFC02 in modloader.asi (+0x1fc02) (0x0028F6F8) 
          0x705CE267 in modloader.asi (+0x1e267) (0x0028F714) 
          0x705D0246 in modloader.asi (+0x20246) (0x0028F888) 
          0x705D013C in modloader.asi (+0x2013c) (0x0028F894) 
          0x0053ECC2 AppEventHandler+0xb2 in gta_sa.exe (+0x13ecc2) (0x0028F89C) 
          0x00619B71 _RsEventHandler+0x11 in gta_sa.exe (+0x219b71) (0x0028F8B0) 
          0x00748DA0 _WinMain+0x690 in gta_sa.exe (+0x348da0) (0x0028F950) 
          0x705CFB94 in modloader.asi (+0x1fb94) (0x0028F970) 
          0x705CDE46 in modloader.asi (+0x1de46) (0x0028F9A0) 
          0x705CB83B in modloader.asi (+0x1b83b) (0x0028F9F4) 
          0x705CFBBB in modloader.asi (+0x1fbbb) (0x0028FA14) 
          0x705CE202 in modloader.asi (+0x1e202) (0x0028FA44) 
          0x705D07BB in modloader.asi (+0x207bb) (0x0028FBD0) 
          0x705D0188 in modloader.asi (+0x20188) (0x0028FBE8) 
          0x705CDF18 in modloader.asi (+0x1df18) (0x0028FC18)        

 

Link to comment
Share on other sites


We already talked here about opcode 0D42: 0D43: 0D46:

0D42: and 0D46: have the hint "IF and SET"
so it makes sense to use it as condition

{$CLEO}
{$USE CLEO+}
{$USE newOpcodes}

thread 'PHONE'
wait 1000

while true
    wait 0
    if
        0AB0:   is_key_pressed 8// Backspace key
    then
        if                                                                                                                             
            0D42: load_txd "phone" from "MODELS\TXD\PHONE.TXD"// IF and SET                                                            
        then                                                                                                                           
            0D43: 8@ = txd "phone" id                                                                                                  
            if                                                                                                                         
                0D46: 4@ = find_texture "phone" in_dictionary 8@ // IF and SET                                                         
            then                                                                                                                       
                while 0AB0:   is_key_pressed 8// Backspace key                                                                                                             
                    wait 0                                                                                                             
                    0D7E: draw_sprite_with_texture 4@ at_cornerA 1600.0 600.0 cornerB 2000.0 1200.0 color 255 255 255 255 angle 0.0    
                end                                                                                                                    
            end                                                                                                                        
        end                                                                                                                            
    end
end

 

It also works with opcode    03F0:  and 03E3:

                while 0AB0:   is_key_pressed 8// Backspace key
                    wait 0
                    03F0: enable_text_draw 1
                    03E3: set_texture_to_be_drawn_antialiased 1
                    0D7E: draw_sprite_with_texture 4@ at_cornerA 1000.0 200.0 cornerB 2200.0 1400.0 color 255 255 255 255 angle 0.0
                end

but i can't see a difference and i'm not sure if it makes sense, because 03F0:  and 03E3: are standard R* codes

and 0D7E: is a NewOpcode code that works without 03F0:  and 03E3:

 

 

 

 

these codes:
0AD3: string_format 10@s format "%d" 31@
0D42: load_txd 10@s from "MODELS\TXD\PHONE.TXD" // IF and SET      
0D43: 8@ = txd 10@s id
0D46: 5@ = find_texture 10@s in_dictionary 8@ // IF and SET

 

requires to know what is 31@
and what are the image names inside of PHONE.TXD"

 

 

Edited by ZAZ
Link to comment
Share on other sites

55 minutes ago, ZAZ said:

requires to know what is 31@
and what are the image names inside of PHONE.TXD"

31@ is integer 1 to 5. Image names inside PHONE.TXD are named "1", "2" and so on.

So, "IF" before the 0D42 works as "check if loaded" ?

Link to comment
Share on other sites

Update.
IFs did not help at all.

I remembered that I have a script called "refresh.cs". It reloads specified mod on-the-fly when you press a key combo.
It is using these two opcodes.

0ABA: terminate_all_custom_scripts_with_this_name 3@v 
0A92: stream_custom_script 4@v

So, I loaded my game, activated my mod. Loaded another save, reloaded the script with refresh.cs and guess what - no crash.
I think the reason for crash is not in my code. Either it is in CLEO or Modloader. I bet on the latter. The reason is unknown but I think something is not cleaned up on reloading savegame.
In my case there are two workarounds, as far as I see.
1. Add a loader that would stop and restart my script once right after loading the game.
2. Replace the second texture (which is only letters on black background) with GXT keys.

Oh, and I found another thing that prevents crash but adds flickering.
Add "wait 500" after "0D46: 5@ = find_texture 10@s in_dictionary 8@".

Edited by vladvo
Link to comment
Share on other sites

10 hours ago, vladvo said:

So, "IF" before the 0D42 works as "check if loaded" ?

Not only "IF"

This a conditional check

if                                                                                                                             
    0D42: load_txd "phone" from "MODELS\TXD\PHONE.TXD"                                                           
then                                                                                                                           
    <code>                                                                                                          
end

high level syntax if..then..end

read tutorial

 

This a conditional check in low level syntax

if                                                                                                                             
    0D42: load_txd "phone" from "MODELS\TXD\PHONE.TXD"                                                           
else_jump @NextLabel

<code>

:NextLabel

 

 

Maybe it works without putting in a conditional check

I got everything working in this way

Textur names 1 to 5 as string by opcode 0AD3:

{$CLEO}
{$USE CLEO+}
{$USE newOpcodes}
thread 'PHONE'
wait 1000

1@ = 1

while true
    wait 0
    if
        0AB0:   is_key_pressed 8// Backspace key
    then
        if                                                                                                                             
            0D42: load_txd "phone" from "MODELS\TXD\PHONE.TXD"// IF and SET                                                            
        then                                                                                                                           
            0D43: 8@ = txd "phone" id
            0AD3: 10@s = format "%d" 1@                                                                                                  
            if                                                                                                                         
                0D46: 4@ = find_texture 10@s in_dictionary 8@ // IF and SET                                                         
            then                                                                                                                       
                while 0AB0:   is_key_pressed 8// Backspace key                                                                                                             
                    wait 0                                                                                                             
                    0D7E: draw_sprite_with_texture 4@ at_cornerA 1000.0 200.0 cornerB 2200.0 1400.0 color 255 255 255 255 angle 0.0  
                end
                1@ += 1
                if
                    1@ > 5
                then
                    1@ = 1
                end                                                                                                                    
            end                                                                                                                        
        end                                                                                                                            
    end
end

 

 

 

3 hours ago, vladvo said:

Oh, and I found another thing that prevents crash but adds flickering.

Add "wait 500" after "0D46: 5@ = find_texture 10@s in_dictionary 8@".

 

long wait times are counterproductive

 

 

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

3 hours ago, ZAZ said:

I got everything working in this way

Well, I have two textures loaded. Here's a link to the mod. It would be easier that way. Not complete, but working to a degree. Activate by typing PPP (cheatstring), scroll with mouse, right-click to close, left-click to call.
https://www.mediafire.com/file/xtzbsaiz3fgxhrh/Phone.zip/file
Steps to make it crash:

1. Run GTA

2. Load a save.

3. Activate phone

4. Load a save.

5. Activate phone again.

6. Scroll ------> Crash.

 

Another odd thing is that if after point 5 ("Activate phone again") I change screen resolution - everything works fine.

 

 

Link to comment
Share on other sites

13 hours ago, vladvo said:

Here's a link to the mod.

snf snf.. mmm.. i can smell a new mod from vladvo bakery.. nice 😉

Link to comment
Share on other sites

Well, kinda solved the problem by going to "standard" opcodes:
0390: load_txd_dictionary
038F: load_texture '1' as 1

No crash, but no more rotation of textures.

Link to comment
Share on other sites

12 hours ago, vladvo said:

Well, kinda solved the problem by going to "standard" opcodes:

Do you need a test? If yes just post here the mod and explain what my objectives are 😉

Link to comment
Share on other sites

2 hours ago, ArmanCan said:

Do you need a test? If yes just post here the mod and explain what my objectives are

Thanks for the offer.  A bit later. Have to get rid of obvious bugs first. And there's still a problem with calling firefighters - they don't do anything yet. Not sure how to force them to.

Link to comment
Share on other sites

51 minutes ago, vladvo said:

Thanks for the offer.  A bit later.

ok whenever you want 😉

Link to comment
Share on other sites

9 hours ago, ArmanCan said:

ok whenever you want

I updated the script https://www.mediafire.com/file/xtzbsaiz3fgxhrh/Phone.zip/file

Not really for testing yet, but it works. Might pop up some debug messages and timers. Take a look if you want to. Cops and homies just arrive and do nothing. Firemen just pass by. Its going to be a hard one to make them put out fires with water cannon.
Taxi should work perfectly - it is my Taxi77 mod, just stripped a bit and adapted to Phone mod.
Medics - I think it's done in most part. The idea is that when they arrive - they search (look) for dead chars. If none found for 15 seconds - they will get into the car and drive away. If you kill one of them - the other one will revive him. If one medic and a random ped is killed - the remaining medic will first heal he colleague.

I think I'll add a pizza courier later. Maybe adapt my Swmotr's bike shop as well - bicycle delivery.

If you have any ideas  - let me know.
The reason why I started all this - I wanted a phone mod that suits the 1992's atmosphere. The ones available are all about smartphones and such. Kinda out of time, imo. I used Motorola MicroTac model. https://en.wikipedia.org/wiki/Motorola_MicroTAC 

Link to comment
Share on other sites

8 hours ago, vladvo said:

Take a look if you want to.

ok but what my objectives are and how it works? 😃

Link to comment
Share on other sites

5 minutes ago, ArmanCan said:

ok but what my objectives are and how it works? 😃

Ah, type PPP (as a cheat code). CJ will hold a phone and a phone will appear in lr corner of the screen. Scroll with mousewheel, call with leftclick, close phone with rightclick.

No objectives yet. Just try it out.

Link to comment
Share on other sites

spacer.png

 

@vladvo this script is mostly working good.. i really liked that but off course there are some funny bugs...

- The firefighters were driving crazy..😃

- The ambulance refused to come here alone.. i could only make them spawn with the cops.. 🤔

- The homies couldn't come to my spot (Palomino Creek) they could only spawn in Grove Street..

Edited by ArmanCan
Link to comment
Share on other sites

9 hours ago, ArmanCan said:

funny bugs...

Yea, the firefighters don't work. 

As for ambulance - I had no problems with it. Homies should spawn too. They will drive to you in Greenwood car.

Link to comment
Share on other sites

1 hour ago, vladvo said:

As for ambulance - I had no problems with it.

maybe they couldn't find a dead body..🤔

Link to comment
Share on other sites

1 hour ago, ArmanCan said:

maybe they couldn't find a dead body..

Nope, they should come, stop, exit car and search. Taxi looks strange. Why is it black ? 

Link to comment
Share on other sites

9 hours ago, vladvo said:

Nope, they should come, stop, exit car and search

Ok i got it..

9 hours ago, vladvo said:

Why is it black ? 

Because i've added new color to it 

Link to comment
Share on other sites

  • 4 weeks later...

"the firefighters don't work" will work idk if you still need it and ambulance too with call i mean

Link to comment
Share on other sites

@vladvo by the way.. i have an idea for your script..

 

Cleoude has a "Phone Improvements" script and i'm soooo pretty sure that you may collab and create a GTA IV style interactive phone and phonecalls 😉

Link to comment
Share on other sites

10 minutes ago, ArmanCan said:

you may collab

No, thanks. I prefer to do it on my own. It's mostly done already. Still needs a lot of polishing and checking. 

I've added pizza courier and roadside assistance. Courier will bring a pizza. When you call roadside assistance - a mechanic will come and fix burst tyres and a restore car health to 555hp if it is below 550.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.