GithubHelp home page GithubHelp logo

reton's People

Contributors

h3x4n1um avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

reton's Issues

Error reading pp.dat

error code 2
Hi H3x4n1um.

In version 7.5.1 of PVZ2, I could use your rton-json tool without problem in the pp.dat file.

Yesterday was filtered the latest version of the game (7.6.1), but now rton-json does not work with the pp.dat file of the new version; when I want that rton-json to work with the pp.dat file, the following message appears:

Error reading bytecode 0x46 at 0x9a!!!
Error code: 2

As I said before, there was no problem with rton-json in the conversion of the pp.dat file of the previous version of the game, but now rton-json can not read the pp.dat file from the new version.

So, so you can check that error message, attach my pp.dat file and I must clarify that I use the latest version 2.7.2 of rton-json.

What causes that error message? There is some solution?

I hope your answer.
File pp dat.zip

Problem about float type

'Infinity', '-Infinity' and 'NaN' are existed in the float and double type.
PositiveInfinity
NegativeInfinity

When converting these values, the tool will convert them into null without distinction. Here is the sample file.
PlantLevels.zip

Improving RTON format and hopefully some other issues

Why would I propose this?

I recently finished 1Zulu's RTONParser and a tool for the reverse written in Python and it's working very well: https://github.com/Nineteendo/PVZ2tools/tree/master/RTONConverter

Format

I suggest a more logical format (but I'm not sure if -uRTON_int32_t is correct):

Bytecode Type Limitations
0x0 false / RTID() False / must be used after 0x83
0x1 true True
0x2 RTID(d.d.hhhhhhhh@x) must be used after 0x83
0x3 RTID(x@x) must be used after 0x83
0x8 int8_t -128 to 127
0x9 int8_t_zero 0
0xa uint8_t 0 - 255
0xb uint8_t_zero 0
0x10 int16_t -32768 to 32767
0x11 int16_t_zero 0
0x12 uint16_t 0 to 65535
0x13 uint16_t_zero 0
0x20 int32_t -2147483648 to 2147483647
0x21 int32_t_zero 0
0x22 float Single-precision floating-point
0x23 float_zero 0.0
0x24 uvarint32_t 0 to 2147483647
0x25 varint32_t -2147483648 to 2147483647
0x26 uint32_t 0 to 4294967295
0x27 uint32_t_zero 0
0x28 uvaruint32_t 0 to 4294967295
0x40 int64_t -9223372036854775808 to -9223372036854775807
0x41 int64_t_zero 0
0x42 double Double-precision floating-point
0x43 double_zero 0.0
0x44 uvarint64_t 0 to 9223372036854775807
0x45 varint64_t -9223372036854775808 to 9223372036854775807
0x46 uint64_t 0 to 18446744073709551615
0x47 uint64_t_zero 0
0x48 uvaruint64_t 0 to 18446744073709551615
0x81 latin_string uRTON_t folowed by only Roman
0x82 utf8_string uRTON_t folowed by only Unicode
0x83 rtid Subtypes 0x0, 0x2and 0x3
0x84 rtid_empty? RTID()?
0x85 object Ends with 0xff
0x86 array Subtype 0xfd followed by uRTON_t ends with 0xfe
0x90 cached_latin_string uRTON_t folowed by only Roman
0x91 cached_latin_string_recall followed by uRTON_t
0x92 cached_utf8_string uRTON_t folowed by only Unicode
0x93 cached_utf8_string_recall followed by uRTON_t
0xfd array_start must be once followed by 0xfe
0xfe array_end has to used after array_start
0xff object_end has to used after object

Potential Issues

In my research I have stumbled across multiple issues that might extend to your tool as well:

Duplicate Keys

A file can contain duplicate keys, in most coding languages this leads to the first value of the first key being replaced by the value of the last key.
I'm afraid this will require much work to solve. I used arrays of tuples and a FakeDict class to make the json library interpret them as a dictionary with duplicate keys, no idea how you could approach this.

Latin strings

Non-unicode strings are probably latin-1 and not ASCII, this also complicates converting json back to rton.

Repairing files

catch errors related to end of file:

  • not enough data for a number
  • no data left to specify the next data type
  • unicode with an unexpected character length (just mention it during the conversion)
  • array with an unexpected length (use array end to end the array not the length)

Extension

[objects][objclass] defines the extension when the json doesn't include it pp.rton instead of pp.dat.rton:

  • ["DraperSaveData", "GlobalSaveData", "PlayerInfoLocalSaveData", "LootSaveData", "SaveGameHeader"] result in .bin
  • "PlayerInfo" results in .dat
  • others result in rton

The key type 0x52 cannot read

Hello .

when trying to convert a file it throws me the following error:

rton-json made by H3x4n1um
Version: 2.7.7 - 32-bit executable
Compiled on Oct 24 2019 at 23:08:16
Credits: nlohmann for his awesome JSON parser and fifo_map

Enter file or folder path: /dos/Descargas/PvZ2TodoGratis(7.2.1)JhalebNOPE/products-20200310.rton

Processing file "/dos/Descargas/PvZ2TodoGratis(7.2.1)JhalebNOPE/products-20200310.rton" - RTON Detected
Error reading bytecode 0x52 at 0x8000!!!
Error code: 2

Finished

Files:
https://drive.google.com/drive/folders/1zE3Zs3UNPLi7xqR5-hJFNpLAjOzW5AeQ?usp=sharing

Any suggestions.

Boundary Check&parsing problem

I carefully checked rton2json.cpp and found some problems:
1.Check if cache string exist in vector
Creat a string stack,that's ok:

	std::vector <std::string> stack_0x91;
	std::vector <std::string> stack_0x93;

But need to handle error...

	 case 0x91:{
            //recall
            res.push_back(stack_0x91[unsigned_RTON_num2int(read_RTON_num())]);  //Naive, you don't know if a cache string in the vector now
     }
    // ...
    case 0x93:{
            //recall
            res.push_back(stack_0x93[unsigned_RTON_num2int(read_RTON_num())]);  //As above...
            break;
        }

Read the memory out of len may cause undefine behavior!
To solve this ,a possible solution can be:
1.Creat a class handle it.(troublesome,but rubust)
2.Just set a variable to keep the number of cache string.
2. Braces of json are in pairs:

	     //end of object
        case 0xFF:{  //check count 0x85 = 0xff ???,should not check it until the parser panic...
            break;
        }

The 0x85 and 0xff should be handle as a pair.(Treat it as the braces in caculator)
What if someone writes 0x85 0x90 0x01 0x6d 0x24 0x01 0xff 0xff in RTON...
!!!
3.Key-Value pair problem:
Basically everything in json is key:value pairs and values

		"objclass": "TideProperties", "aliases": [ "Tide" ] 

And the Root of a json must be a map(0x85):

{
    "#comment": "Embedded RSB Version",
    "version": 1,
    "objects": [
        {
            "objclass": "PVZVersion",
            "objdata": {
                "major": 0,
                "minor": 0,
                "content": 0
            }
        }
    ]
}

Then,the key only can be String(0x90/91/81)and values can be any of them (0x83/92/93/24/85/86)
Array(0x86) only contains values

"Plants":["Peanut","Sunflower",{"A":"B"}]

So,you need to edit the logic of Parsing,using recursive descent parsing or whatever...

Error: vector::_M_range_check: __n (which is 112414) >= this->size() (which is 112414)

Greetings. Thank you for your work.
I've been playing PvZ2 for a long time. The pp.dat file has grown to over 112 Kb. When trying to convert it, the following message is displayed:

Processing file "pp.dat" - RTON Detected
vector::_M_range_check: __n (which is 112414) >= this->size() (which is 112414)
Completed in 0.873305s

Finished

It is written that it is completed, but an error code is displayed and the file is not created.

Pp.dat parse error

Hi, thanks for providing this tool. I hope someone can check how I'm using it.

  1. I copy pp.dat from android to my laptop
  2. I run the reton executable file
  3. Pp.dat is recognised as a rton file. A new folder is created which contains a json file.
    (without editing the json file, to identify at which stage my issue is occurring)
  4. I again run the executable, now producing a .Rton file.
    5 I rename this file pp.dat
    6 I copy this version of pp.dat back to my android device
  5. On attempting to open pvz2, the screen goes black for a few seconds then back to the home screen.
  6. On replacing pp.dat with the old version, the app opens as usual

I hope that I've explained that even without editing the json file I'm still experiencing issues. I would appreciate any thoughts or advice. Thanks in advance.

Rton-Json working fine, but json-rton not

I tried using a custom save file and yknow slamming it through and then editing it and reprocessing back to rton, but it only sends the logs without the actual json-rton (github doesnt support json files so i cant send to you the edited one), you may have corrupted the key sorting a bit in your latest patch, im going to try and older version and see what happens

The changes i made to it were the levels (l variable in the bottom section of the json) and amount of plants

0x84 - empty rtid

In one of the files I encountered the data type "0x84", tried to convert it in other programs there converting to "RTID (0)". The "Projectile" property in two places. The file is attached.
PLANTPROPERTIES.zip

Empty dictionaries are listed as "null"

If the original JSON file that was compressed to RTON contained keys the value of which was an empty dictionary, rton2json outputs null instead of [].

Like, if the original was

{
    ...
    "objdata": {}
    ....
}

rton2json would convert it to

{
    ...
    "objdata": null
    ....
}

This is probably a bug.

Another Error Reading pp.dat

Hello h3x4n1um,

I'm using your program to convert pp.dat from PvZ2 7.81 to a json file and get the following error
Schermopname-13
Error reading bytecode 0x16 at 0xfffffffffffffffe!!!
Error code: 2

I hope you know how to fix this error

Sincerely Yours, Atto.

I've also attached the pp.dat file.
pp.zip

ENHANCEMENT: New feature, or a new tool to "ENCRIPT" .RTON files

Hi dear h3x4n1um, I thank you for your tool, it's really very useful to create several types of hacks and also custom levels.

But please I would LOVE for you to create a new tool that can "encrypt" RTON files. The reason is that on Youtube I used to post files like pp.dat and some custom levels. But I just stopped doing them because there is a lot of "softthieves" in YT and they re-upload my hacks WITHOUT giving me proper credits or asking for my permission, and to top it off they have the nerve to edit my files even though they're in RTON format and NOT JSON, placing their names and deleting mine.

I would urgently need a tool that "corrupts" an RTON file through a password, but WITHOUT making it unusable or unreadable for PVZ2, just uneditable. I mean that I put extra bytes in it (or subtract them except for important strings), so that any filestealer can in no way convert the "encrypted" file to JSON with no other tool, not even TileTurnip's PvZ2Tool, or SmallPC's SPCUtil, and instead they get multiple bytecode read errors; but the only way to convert it to JSON is by entering the password created with that magic encryption tool. Thanks for reading my suggestion.

freeshopmod
freeturkeypultlevel

Feature request: Implement non-interactive use

Currently, when the program rton2json is instructed to unpack a subdirectory, after it is done, it displays the message Finished and waits for the user to press Enter. I often unpack the RTON files of a whole subtree of directories and the program constantly waiting for me to press Enter is rather annoying. Could you please implement a command-line option that suppresses this pause?

Value type 0x40

0x40 is a existed value type.
This is what I tested and it is a Int64 byte code.

"invalid vector subscript"

After the latest PvZ2 update, this and other rton-to-json converters fail to convert PvZ2's pp.dat.
This one failed with "invalid vector subscript" while another one (TileTurnip's PvZ2Tools) gave the error message "The key type 0x46 cannot read, abort at 0x00000093"

I used the program to edit pp.dat Pvz2, but it did not open the game

Can it be used in pvz 2?
Sorry my english.
I used the program to edit( but I did not edit I wanted to see if the game would run, I did the same as the guy who asked you before).
I copy what he said

1. I copy pp.dat from android to my laptop
2. I run the rton executable file
  1. Pp.dat is recognised as a rton file. A new folder is created which contains a json file.
    (without editing the json file, to identify at which stage my issue is occurring)
    4. I again run the executable, now producing a .Rton file.
    5 I rename this file pp.dat
    6 I copy this version of pp.dat back to my android device
    On attempting to open pvz2, the screen goes black for a few seconds then back to the home screen.
    On replacing pp.dat with the old version, the app opens as usual

Sorry, sorry I'm not a programmer and I don't know much but I saw that they are different

I do not know if I am using it well, check the .dat and they are not the same. I attach a pdf https://drive.google.com/file/d/1lLbKhnEI5AT0dcHTfXGIm9YMnVFnb9Zp/view?usp=sharing

Thanks for your time

About rton>json>rton

Hi. I need your help, I'm not an advanced user neither much less a developer. I know that RTON is a PopCap owner file, creator of the saga Plants vs Zombies, and as a game fan I would also like to make reverse engineering to PvZ.

On Android, the game creates many RTON files in your installation directory, and what I want is to edit some RTON files converted first to JSON files, (because as a json file is easier to edit) and after editing the JSON file, reconvert it in a RTON file.

So in Github the only reference that I found about RTON is your project and I have downloaded it, but I don't know how to use your RTON-JSON/JSON-RTON converter and there is not executable file inside the ZIP file that can help me with what I need.

So, please, you can tell me how your project is used for what I need? Remember that I'm not an advanced user.

I wait for your answer.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.