Main Menu

The decoding is not working...

Started by xboxisfinished, 10 Aug, 2021, 06:06 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

xboxisfinished

I just wanted to inform you that decoding is not working, can you help me here?

SamuraiCrow

Try bypassing the encryption in both the saver and the loader.  If it works after that, we'll know it's in the encryption.  If that doesn't help we can at least narrow it down from there.

xboxisfinished


xboxisfinished

By the way...I just removed the decoding/coding code and when I saved the file it still saved it encrypted with 1.80 MB in size...as if the decode/encode code is not needed at all. When I view the file using more...I still receive jibberish and encryption. Perhaps it is saving memory into file instead of actual values in array and placing them in 49 row to 49 columns.

I could be wrong. Do you want me to send you the source code of my editor and you can try it from your end or prefer this method?

SamuraiCrow

Does your Amiga have internet where you can post the subroutines as they were entered?

By the way, there is 12k of binary before the text.

xboxisfinished

It returned overflow again. It tried to read jibberish and it got value of over 10 digits and more to return....it failed. It still trying to read jibberish and place the jibberish into the actual array.

My Amiga does not have internet, but it is right beside the PC and both Amiga and PC use differen monitors side by side.I can look at the subroutine of your choice on the left and enter them here if you want. What are you looking for? The code you gave me? I entered 100% exactly as you have given me and I did remove the encryption/decryption code as requested.

However, I am ready for any orders you wish to give me.

SamuraiCrow

The XOR line and the rotate line have to be in reverse order of each other in the encoder and decoder. 

SamuraiCrow

I have thought of a different way to encode the strings to save 3 bytes per string just storing the length of each string instead of the address.  If the strings are too long it won't make much difference.  The idea that the file grew when making a new encoded file suggests that the strings are being read wrong from memory.

SamuraiCrow

What does the string length calculator look like?

xboxisfinished

#9
Quote from: SamuraiCrow on 10 Aug, 2021, 08:16 PM
The XOR line and the rotate line have to be in reverse order of each other in the encoder and decoder.

I will do this now...brb...when you said reverse what do you mean exactly?

ROL.W 5, C
Doke C, Deek(c) Xor $A55A

And the other loop should be:

Doke C, Deek(c) Xor $A55A
Ror.w 5, C

You mean like this
--------------------
Doke C, Deek(c) Xor $A55A
ROL.W 5, C


And the other loop should be:
Ror.w 5, C
Doke C, Deek(c) Xor $A55A

Reversing it..still gave an overflow. It is saving over 2 MB a file. Offset value is 784239096 that is too large.  What do you mean stringlength calculator?

xboxisfinished

This is the code for loading:
Loading a level

Load Dir$+_PROJECTNAME$+"/"+_DEFAULTLEVELS$(_LEVELINDEX),16
For C=Start(16) to Start(16)-Length(16)-2 Step 2
  Doke C, Deek(C) xor $A55A
  Ror.w 5,C
Next C

For HEIGHT=0 To 49
  For WIDTH=0 to 49
    OFFSET=Leek(HEIGHT*49+WIDTH)*4+Start(16)
    LEVELGETCARD$(WIDTH,HEIGHT)=Peek$(12001+Start(16)+OFFSET, 32768,Chr$(0))
    LEVEL(WIDTH,HEIGHT)=Peek(Start(16)+9604+(49*HEIGHT+WIDTH))
  Next WIDTH
Next HEIGHT
Erase 16


Saving a level

For N=0 to _NUMOFLEVELS-1
  _DEFAULTLEVELS$(N)="level"+str$(N)
  _DEFAULTLEVELSPROPERTIES$(N)="level"+str$(N)+" Properties"

STRINGLENGTH=0
For HEIGHT=0 TO 49
  For WIDTH=0 TO 49
    LEVELGETCARD$(WIDTH,HEIGHT)=LEVELGETCARD$(WIDTH.HEIGHT)+Chr$(0)
    STRINGLENGTH=STRINGLENGTH+Len(LEVELGETCARD$(WIDTH,HEIGHT))
  Next WIDTH
Next Height

Reserve As Work 16, (STRINGLENGTH+12001+3) and Not 3
OFFSET=12001

For HEIGHT=0 TO 49
  For WIDTH=0 TO 49
    Poke$(Start(16)+OFFSET),(LEVELGETCARD$(WIDTH,HEIGHT))
    Loke Start(16)+(49+HEIGHT+WIDTH)*4, OFFSET
    OFFSET=OFFSET+Len(LEVELGETCARD$(WIDTH,HEIGHT))
    Poke Start(16)+(49*HEIGHT+WIDTH)+9604, LEVEL(WIDTH,HEIGHT)
  Next WIDTH
Next Height
For C=Start(16) To Start(16)+Length(16)-2 Step 2
   Rol.w 5,C
   Doke C,Peek(C) xor $A55A
Next C
Save Dir$+_PROJECTNAME$+"/"+_DEFAULTLEVELS$(N)
Erase 16
Next N

SamuraiCrow

I saw the bug right away.  The length should be added to the start.  Not subtracted.

xboxisfinished

I typed here wrong. it is add to start.

For C=Start(16) to Start(16)+Length(16)-2 Step 2

is what I have for both. It still does the same problem. I still get overflow. You are sure the code logic you gave me is correct? Can I send you my source code so you can check it out yourself?

xboxisfinished

This code is the issue:

Poke$(start(16)+offset),VarPtr(LevelGetCard$(Width,Height))+2

I cannot use VarPtr here and I removed it. Could this be the problem? Because if I put VarPtr it gives me syntax error. What advice do you have?

SamuraiCrow

Wrong syntax.  Remove the varptr and the +2. Just pass the variable.  Sorry.