Ultimate Amiga

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2   Go Down

Author Topic: The decoding is not working...  (Read 4575 times)

0 Members and 1 Guest are viewing this topic.

xboxisfinished

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 205
  • Generic Amiga User
    • gamemakermagazine.com
The decoding is not working...
« on: August 10, 2021, 05:06:16 PM »

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

SamuraiCrow

  • compile-time wierdo
  • Forum Mod
  • A1200
  • *****
  • Karma: 5
  • Offline Offline
  • Gender: Male
  • Posts: 946
  • Compile-time wierdo
Re: The decoding is not working...
« Reply #1 on: August 10, 2021, 06:28:01 PM »

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.
Logged

xboxisfinished

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 205
  • Generic Amiga User
    • gamemakermagazine.com
Re: The decoding is not working...
« Reply #2 on: August 10, 2021, 06:42:49 PM »

doing it right now
Logged

xboxisfinished

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 205
  • Generic Amiga User
    • gamemakermagazine.com
Re: The decoding is not working...
« Reply #3 on: August 10, 2021, 06:53:57 PM »

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?
Logged

SamuraiCrow

  • compile-time wierdo
  • Forum Mod
  • A1200
  • *****
  • Karma: 5
  • Offline Offline
  • Gender: Male
  • Posts: 946
  • Compile-time wierdo
Re: The decoding is not working...
« Reply #4 on: August 10, 2021, 06:56:12 PM »

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.
Logged

xboxisfinished

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 205
  • Generic Amiga User
    • gamemakermagazine.com
Re: The decoding is not working...
« Reply #5 on: August 10, 2021, 07:02:05 PM »

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.
Logged

SamuraiCrow

  • compile-time wierdo
  • Forum Mod
  • A1200
  • *****
  • Karma: 5
  • Offline Offline
  • Gender: Male
  • Posts: 946
  • Compile-time wierdo
Re: The decoding is not working...
« Reply #6 on: August 10, 2021, 07:16:30 PM »

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

SamuraiCrow

  • compile-time wierdo
  • Forum Mod
  • A1200
  • *****
  • Karma: 5
  • Offline Offline
  • Gender: Male
  • Posts: 946
  • Compile-time wierdo
Re: The decoding is not working...
« Reply #7 on: August 10, 2021, 07:24:51 PM »

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.
Logged

SamuraiCrow

  • compile-time wierdo
  • Forum Mod
  • A1200
  • *****
  • Karma: 5
  • Offline Offline
  • Gender: Male
  • Posts: 946
  • Compile-time wierdo
Re: The decoding is not working...
« Reply #8 on: August 10, 2021, 07:38:42 PM »

What does the string length calculator look like?
Logged

xboxisfinished

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 205
  • Generic Amiga User
    • gamemakermagazine.com
Re: The decoding is not working...
« Reply #9 on: August 10, 2021, 08:45: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?
« Last Edit: August 10, 2021, 08:52:46 PM by xboxisfinished »
Logged

xboxisfinished

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 205
  • Generic Amiga User
    • gamemakermagazine.com
Re: The decoding is not working...
« Reply #10 on: August 10, 2021, 09:05:58 PM »

This is the code for loading:
Loading a level
Code: [Select]
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
Code: [Select]
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
Logged

SamuraiCrow

  • compile-time wierdo
  • Forum Mod
  • A1200
  • *****
  • Karma: 5
  • Offline Offline
  • Gender: Male
  • Posts: 946
  • Compile-time wierdo
Re: The decoding is not working...
« Reply #11 on: August 10, 2021, 10:11:23 PM »

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

xboxisfinished

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 205
  • Generic Amiga User
    • gamemakermagazine.com
Re: The decoding is not working...
« Reply #12 on: August 10, 2021, 10:18:35 PM »

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?
Logged

xboxisfinished

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 205
  • Generic Amiga User
    • gamemakermagazine.com
Re: The decoding is not working...
« Reply #13 on: August 10, 2021, 11:15:13 PM »

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?
Logged

SamuraiCrow

  • compile-time wierdo
  • Forum Mod
  • A1200
  • *****
  • Karma: 5
  • Offline Offline
  • Gender: Male
  • Posts: 946
  • Compile-time wierdo
Re: The decoding is not working...
« Reply #14 on: August 10, 2021, 11:28:00 PM »

Wrong syntax.  Remove the varptr and the +2. Just pass the variable.  Sorry.
Logged
Pages: [1] 2   Go Up
 

TinyPortal 2.2.2 © 2005-2022