Author Topic: Mapdecompiler updated (Eternal Embers)  (Read 8365 times)

0 Members and 1 Guest are viewing this topic.

Not Yet Rated!

Offline epinter

  • Member
  • *
  • Topic Author
  • Posts: 41
  • Country: br
  • Karma: +5/-0
  • Gender: Male
    • View Profile
    • Awards
Mapdecompiler updated (Eternal Embers)
« on: 05 December 2021, 06:12:28 »
Hi,

I was trying to extract the map from Eternal Embers, and the mapdecompiler didn't work. I found an old source code here at titanquestfans.net and managed to make a quick change to extract all files from new maps. Editor opened the maps, so I think everything should work... I don't know if there's any other fix needed, feel free to clone the repo and update.

Unfortunately, I didn't found a way to contact the original authors, I only found a link to the source code. I think there's no problem posting on github (the code was already public on mega.nz). If the author wants I can remove from github, no problem, I'm just trying to contribute.


All credits goes to p0a (original author I think) and knightsouldier.

Source code available at github:

https://github.com/epinter/tq-mapdecompiler


Download:

https://github.com/epinter/tq-mapdecompiler/releases

Hope this helps.
« Last Edit: 05 December 2021, 09:01:34 by epinter »

Not Yet Rated!

Offline xiaorantu

  • Member
  • *
  • Posts: 23
  • Country: cn
  • Karma: +0/-0
  • Gender: Male
    • View Profile
    • Awards
  • Time Zone: +8
Re: Mapdecompiler updated (Eternal Embers)
« Reply #1 on: 05 December 2021, 08:56:54 »
I download the zip. but don't know how to use it

CMakelists.txt
CMakesetting.json
MAPDecomp.cpp
README.md

Not Yet Rated!

Offline epinter

  • Member
  • *
  • Topic Author
  • Posts: 41
  • Country: br
  • Karma: +5/-0
  • Gender: Male
    • View Profile
    • Awards
Re: Mapdecompiler updated (Eternal Embers)
« Reply #2 on: 05 December 2021, 09:00:37 »
Download the mapdecompiler.7z from releases page: https://github.com/epinter/tq-mapdecompiler/releases

Not Yet Rated!

Offline sauruz

  • Maze Lord
  • Global Admin
  • Full Member
  • *
  • Posts: 1625
  • Country: pt
  • Karma: +32/-0
  • Gender: Male
    • View Profile
    • Awards
  • Time Zone: ?
Re: Mapdecompiler updated (Eternal Embers)
« Reply #3 on: 05 December 2021, 12:18:58 »
just to say its works out!

Thank you!
Check my upcoming TQ project - Titanomachy - "https://titanquestfans.net/index.php?topic=910.0"

Not Yet Rated!

Offline Medea Fleecestealer

  • Administrator
  • Full Member
  • *
  • Posts: 2309
  • Country: ch
  • Karma: +24/-0
  • Gender: Female
    • View Profile
    • Awards
  • Time Zone: +1
Re: Mapdecompiler updated (Eternal Embers)
« Reply #4 on: 05 December 2021, 13:48:24 »
epinter, just had a report that there's a Trojan on the .7z

Not Yet Rated!

Offline sauruz

  • Maze Lord
  • Global Admin
  • Full Member
  • *
  • Posts: 1625
  • Country: pt
  • Karma: +32/-0
  • Gender: Male
    • View Profile
    • Awards
  • Time Zone: ?
Re: Mapdecompiler updated (Eternal Embers)
« Reply #5 on: 05 December 2021, 13:54:34 »
its a false positive, i just did had sucess decompile the new map
Check my upcoming TQ project - Titanomachy - "https://titanquestfans.net/index.php?topic=910.0"

Not Yet Rated!

Offline Medea Fleecestealer

  • Administrator
  • Full Member
  • *
  • Posts: 2309
  • Country: ch
  • Karma: +24/-0
  • Gender: Female
    • View Profile
    • Awards
  • Time Zone: +1
Re: Mapdecompiler updated (Eternal Embers)
« Reply #6 on: 05 December 2021, 14:11:28 »
Maybe, but he's literally just tried and seen it so the latest fixes haven't worked for false positives.

Not Yet Rated!

Offline epinter

  • Member
  • *
  • Topic Author
  • Posts: 41
  • Country: br
  • Karma: +5/-0
  • Gender: Male
    • View Profile
    • Awards
Re: Mapdecompiler updated (Eternal Embers)
« Reply #7 on: 05 December 2021, 15:49:15 »
Maybe, but he's literally just tried and seen it so the latest fixes haven't worked for false positives.

I had problem with false positives in Windows Defender, but last commit fixed for me. Using virustotal.com before, I consistently saw Defender and MaxSecure detecting as trojan. After the fix, everything is green on virustotal:

https://www.virustotal.com/gui/file/5296e70c5a1d2549537b648b729ad9ee15d90bba6c40b65f4bca056f317d647a

What antivirus do you have?

Not Yet Rated!

Offline Medea Fleecestealer

  • Administrator
  • Full Member
  • *
  • Posts: 2309
  • Country: ch
  • Karma: +24/-0
  • Gender: Female
    • View Profile
    • Awards
  • Time Zone: +1
Re: Mapdecompiler updated (Eternal Embers)
« Reply #8 on: 05 December 2021, 16:09:46 »
It's not me epinter, but one of my fellow mods.  He's getting it with Windows Defender.  Fine for him with virustotal.

Not Yet Rated!

Offline epinter

  • Member
  • *
  • Topic Author
  • Posts: 41
  • Country: br
  • Karma: +5/-0
  • Gender: Male
    • View Profile
    • Awards
Re: Mapdecompiler updated (Eternal Embers)
« Reply #9 on: 05 December 2021, 16:13:45 »
It's not me epinter, but one of my fellow mods.  He's getting it with Windows Defender.  Fine for him with virustotal.

Before I published the last version I uploaded some .7z with false positives. Maybe he downloaded the file as soon as I posted here ?

Not Yet Rated!

Offline Wagi

  • Visitor
  • *
  • Posts: 3
  • Country: be
  • Karma: +0/-0
  • Gender: Male
    • View Profile
    • Awards
  • Time Zone: +1
Re: Mapdecompiler updated (Eternal Embers)
« Reply #10 on: 05 December 2021, 16:18:32 »
Hey o/

It's me

Last release 10hours ago
Last edit 8 hours ago

You did not update the release, it seems.

Also, I checked the source and there are issues and lots of warnings using MSVS2019 because you're playing with the memory manually without checks and safety, although it's fine this is hard to read and can be source of issues.
It's working fine though so let's hope it stays like this.

What changed btw ? From Ragnarok to Eternal Embers ? I'm curious.

Wagi

Not Yet Rated!

Offline epinter

  • Member
  • *
  • Topic Author
  • Posts: 41
  • Country: br
  • Karma: +5/-0
  • Gender: Male
    • View Profile
    • Awards
Re: Mapdecompiler updated (Eternal Embers)
« Reply #11 on: 05 December 2021, 16:42:44 »
Hey o/

It's me

Last release 10hours ago
Last edit 8 hours ago

You did not update the release, it seems.

Also, I checked the source and there are issues and lots of warnings using MSVS2019 because you're playing with the memory manually without checks and safety, although it's fine this is hard to read and can be source of issues.
It's working fine though so let's hope it stays like this.

What changed btw ? From Ragnarok to Eternal Embers ? I'm curious.

Wagi

The release is updated, I just committed after I built the exe.

Actually I changed just a few lines of code. I saw there's a lot of warnings, but to solve everything would require a time I don't have.

Looks like on every release of the game, somebody got this source and increased the "char fileNames[1024][256]" to 2048 or only a little above. But on every release of dlc, there are always a lot of new files, then the change is needed again... The stack limits the array size, so I used malloc to increase the array to 65535.

Code: [Select]
diff --git a/MAPDecomp.cpp b/MAPDecomp.cpp
index e1ee25d..cd2097d 100644
--- a/MAPDecomp.cpp
+++ b/MAPDecomp.cpp
@@ -10,6 +10,8 @@
 #define SHR_SIZE 2 /*sizeof(unsigned short)*/
 #define FLT_SIZE 4 /*sizeof(float)*/
 #define PTR_SIZE sizeof(void*)
+#define FILENAMES_BUFFER_SIZE 65535
+#define FILENAME_SIZE 256
 
 void mkdirtofile(char* path) {
  size_t length = strlen(path);
@@ -67,7 +69,13 @@ void main(int argc, char **argv) {
  fwrite(sec, INT_SIZE, 1, wrlFile);
 
  bool outOfOrder = true;
- char fileNames[1024][256];
+
+ char ** fileNames = (char **) malloc(FILENAMES_BUFFER_SIZE * sizeof(char*));
+
+ for (int i = 0; i < FILENAMES_BUFFER_SIZE; i++) {
+ fileNames[i] = (char *) malloc(FILENAME_SIZE);
+ }
+
  eofdetect = fgetc(mapFile);
  unsigned char* buffer;
  while (!feof(mapFile) && !ferror(mapFile)) {
@@ -318,12 +326,12 @@ void main(int argc, char **argv) {
  }
  //.sd
  else if (0x18 == sec[0]) {
- sprintf_s(fileNames[1023], 255, "%s", argv[2]);
- *(fileNames[1023]+strlen(fileNames[1023])-3) = 's';
- *(fileNames[1023]+strlen(fileNames[1023])-2) = 'd';
- *(fileNames[1023]+strlen(fileNames[1023])-1) = 0;
+ sprintf_s(fileNames[FILENAMES_BUFFER_SIZE-1], 255, "%s", argv[2]);
+ *(fileNames[FILENAMES_BUFFER_SIZE-1]+strlen(fileNames[FILENAMES_BUFFER_SIZE-1])-3) = 's';
+ *(fileNames[FILENAMES_BUFFER_SIZE-1]+strlen(fileNames[FILENAMES_BUFFER_SIZE-1])-2) = 'd';
+ *(fileNames[FILENAMES_BUFFER_SIZE-1]+strlen(fileNames[FILENAMES_BUFFER_SIZE-1])-1) = 0;
 
- writeBuffer(buffer, CHR_SIZE, sec[1], fileNames[1023], "wb");
+ writeBuffer(buffer, CHR_SIZE, sec[1], fileNames[FILENAMES_BUFFER_SIZE-1], "wb");
  }
 
  //Data chunks. Output by other sections.
@@ -341,6 +349,12 @@ void main(int argc, char **argv) {
  eofdetect = fgetc(mapFile);
  }
 
+
+ for (int i = 0; i < FILENAMES_BUFFER_SIZE; i++) {
+ free(fileNames[i]);
+ }
+
+
  //close the world. open the nExt.
  fflush(wrlFile);
  fclose(wrlFile);

EDIT: I will take a look at those code issues when I have some time, at least those that are more critical
« Last Edit: 05 December 2021, 18:25:41 by epinter »

Not Yet Rated!

Offline BioHazardN7

  • Visitor
  • *
  • Posts: 2
  • Country: ua
  • Karma: +0/-0
    • View Profile
    • Awards
  • Time Zone: ?
Re: Mapdecompiler updated (Eternal Embers)
« Reply #12 on: 10 December 2021, 16:33:27 »
Hello, I have a problem with unpacking the map. When I decompiled the map, the information about the zones that the player cannot enter (the "Passable" brush on the level editor panel) is not imported.
Screen #1
P.S. I applied this zone myself, it was not in the decompiled map

For example, in the original, it is not possible to go into the river. After decompiled a level with river, do a Rebuld patch and compile the map, I can freely move into these zones.
Screen: #2, #3

Can you say something about this situation?

P.S.2. Sory for my bad English.
Sorry for my bad English

Not Yet Rated!

Offline nargil66

  • Forum Moderator
  • Full Member
  • *
  • Posts: 2490
  • Country: bg
  • Karma: +67/-1
  • Gender: Male
  • Mesh-Texturing Beautifier :)
    • View Profile
    • Awards
  • Time Zone: ?
Re: Mapdecompiler updated (Eternal Embers)
« Reply #13 on: 12 December 2021, 14:52:22 »
@epinter
A little offtopic - is it possible for the old TQCam Tool to be updated for EE? It was a total blast to play with, but it got broken after Atlantis. Koderkrazy's cheat engine table can still edit the camera angle, but it isn't interactive as the old tool:
Spoiler for Hiden:

Not Yet Rated!

Offline epinter

  • Member
  • *
  • Topic Author
  • Posts: 41
  • Country: br
  • Karma: +5/-0
  • Gender: Male
    • View Profile
    • Awards
Re: Mapdecompiler updated (Eternal Embers)
« Reply #14 on: 13 December 2021, 16:58:03 »
Hello, I have a problem with unpacking the map. When I decompiled the map, the information about the zones that the player cannot enter (the "Passable" brush on the level editor panel) is not imported.
Screen #1
P.S. I applied this zone myself, it was not in the decompiled map

For example, in the original, it is not possible to go into the river. After decompiled a level with river, do a Rebuld patch and compile the map, I can freely move into these zones.
Screen: #2, #3

Can you say something about this situation?

P.S.2. Sory for my bad English.

Hi,

I didn't have access to mapdecompiler source code until few days ago, so I can't guarantee there's nothing to be done about this. But for what I have seen in it, there's nothing specific about this kind of zones. Maybe could be something that changed in the Editor, I don't know.

 


SimplePortal 2.3.7 © 2008-2024, SimplePortal