ROM Bugs after delete 1 line [SOLVED]

SGDK only sub forum

Moderator: Stef

Post Reply
User avatar
cloudstrifer
Interested
Posts: 47
Joined: Mon Feb 19, 2018 7:31 pm

ROM Bugs after delete 1 line [SOLVED]

Post by cloudstrifer » Thu Apr 04, 2019 4:11 pm

Hi, please help me, my rom not works correctly after I remove or comment 1 line.
My main.c have 7447 lines.

//SPR_setVisibility(lifes_p1, VISIBLE);

Works
Goof OLD - Working.rar
(233.25 KiB) Downloaded 16 times

After remove line not works
Goof New - Not working.zip
(255.69 KiB) Downloaded 16 times
Using "New rom" 2 enemies don't move, and after 1 minute game crashes.


Thank you!
Last edited by cloudstrifer on Thu Apr 04, 2019 5:24 pm, edited 2 times in total.

User avatar
Stef
Very interested
Posts: 2948
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: ROM Bugs after delete 1 line

Post by Stef » Thu Apr 04, 2019 4:50 pm

I don't understand what you expect from us..
I tested both ROM, and both appears to work. You didn't tell us what is not working anymore in the new ROM.
Also you only provide the ROM so we cannot do anything from just :

Code: Select all

Hi, please help me, my rom not works correctly after I remove or comment 1 line.
My main.c have 7447 lines.

//SPR_setVisibility(lifes_p1, VISIBLE);
At least i can say this, your main file is 7447 lines.. that is definitely insane. Try to modularize and split your code in several file, you will never be able to maintain your code putting everything in a single file (well it's possible but terribly painful).

User avatar
cloudstrifer
Interested
Posts: 47
Joined: Mon Feb 19, 2018 7:31 pm

Re: ROM Bugs after delete 1 line

Post by cloudstrifer » Thu Apr 04, 2019 5:14 pm

Thank you for reply.

Using "New rom" 2 enemies don't move, and after 1 minute game crashes.

I will solve the problem with my code, splitting and cleaning, I'm just writing code, but it became too big.

User avatar
cloudstrifer
Interested
Posts: 47
Joined: Mon Feb 19, 2018 7:31 pm

Re: ROM Bugs after delete 1 line

Post by cloudstrifer » Thu Apr 04, 2019 5:22 pm

Sorry about wasting your time, but now it don't crashes anymore.

Maybe Im crazy :shock:

For now, I will investigate that issue.

Thank you!

hotrodx
Interested
Posts: 30
Joined: Thu Mar 21, 2019 1:23 pm

Re: ROM Bugs after delete 1 line [SOLVED]

Post by hotrodx » Thu Apr 04, 2019 5:35 pm

(Running on an emulator)

I just noticed that when you first load up "Goof NEW.bin", the two sprites do not move. If you do a soft reset, they'd move. If you do a hard reset, they won't move again. So I'm guessing it has something to do with variable initialization failing to account soft resets.

EDIT: Or, some of the variables were used before being initialized, and was initialized AFTER the offending line. When you do a soft reset, it would have value now. But with a hard reset, it's uninitialized again.

User avatar
cloudstrifer
Interested
Posts: 47
Joined: Mon Feb 19, 2018 7:31 pm

Re: ROM Bugs after delete 1 line [SOLVED]

Post by cloudstrifer » Thu Apr 04, 2019 7:06 pm

hotrodx wrote:
Thu Apr 04, 2019 5:35 pm
(Running on an emulator)

I just noticed that when you first load up "Goof NEW.bin", the two sprites do not move. If you do a soft reset, they'd move. If you do a hard reset, they won't move again. So I'm guessing it has something to do with variable initialization failing to account soft resets.

EDIT: Or, some of the variables were used before being initialized, and was initialized AFTER the offending line. When you do a soft reset, it would have value now. But with a hard reset, it's uninitialized again.
I'm looking for mistakes.

Thank you.

nemezes
Interested
Posts: 46
Joined: Sat Mar 31, 2018 1:09 pm

Re: ROM Bugs after delete 1 line

Post by nemezes » Fri Apr 05, 2019 11:31 am

Stef wrote:
Thu Apr 04, 2019 4:50 pm
I don't understand what you expect from us..
I tested both ROM, and both appears to work. You didn't tell us what is not working anymore in the new ROM.
Also you only provide the ROM so we cannot do anything from just :

Code: Select all

Hi, please help me, my rom not works correctly after I remove or comment 1 line.
My main.c have 7447 lines.

//SPR_setVisibility(lifes_p1, VISIBLE);
At least i can say this, your main file is 7447 lines.. that is definitely insane. Try to modularize and split your code in several file, you will never be able to maintain your code putting everything in a single file (well it's possible but terribly painful).
I use everything in one file and the game works fine. :D

I get confused when working with several files.

User avatar
cloudstrifer
Interested
Posts: 47
Joined: Mon Feb 19, 2018 7:31 pm

Re: ROM Bugs after delete 1 line

Post by cloudstrifer » Fri Apr 05, 2019 11:53 am

nemezes wrote:
Fri Apr 05, 2019 11:31 am
Stef wrote:
Thu Apr 04, 2019 4:50 pm
I don't understand what you expect from us..
I tested both ROM, and both appears to work. You didn't tell us what is not working anymore in the new ROM.
Also you only provide the ROM so we cannot do anything from just :

Code: Select all

Hi, please help me, my rom not works correctly after I remove or comment 1 line.
My main.c have 7447 lines.

//SPR_setVisibility(lifes_p1, VISIBLE);
At least i can say this, your main file is 7447 lines.. that is definitely insane. Try to modularize and split your code in several file, you will never be able to maintain your code putting everything in a single file (well it's possible but terribly painful).
I use everything in one file and the game works fine. :D

I get confused when working with several files.
2 enemies are not moving on New rom.
Maybe its a not initialized variable.

User avatar
cloudstrifer
Interested
Posts: 47
Joined: Mon Feb 19, 2018 7:31 pm

Re: ROM Bugs after delete 1 line [SOLVED]

Post by cloudstrifer » Fri Apr 05, 2019 3:52 pm

Confirmed, variable initialization, now enemies only allowed to move after screen creation is complete.

Thank you!

User avatar
cloudstrifer
Interested
Posts: 47
Joined: Mon Feb 19, 2018 7:31 pm

Re: ROM Bugs after delete 1 line [SOLVED]

Post by cloudstrifer » Sat Apr 13, 2019 9:56 pm

I found another error, index out of bounds.
S8 array [6];
...
Array [6] = 0;

Thank you!

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest