Closed Quaker762 closed 7 years ago
I think this might have something to do with weird string null-terminators. I'm being told I can't open a handle to a section due to this..
So it would seem that loading everything from arc.arc is accurate (as seen in attached log.txt). Therefore this MUST have something to do with actually finding the file in the map, but I can't see anything wrong with the code for it..??
Also note that it complains of multiple files of the same name. log.txt
More strange behaviour, attempting to print out keys and indexes results in this each step. I'm surprised it loads anything when I put a different file name in, this is super weird.
EDIT: Okay, I've done a bit more probing, and it seems like there's an error with c_sections
. Stepping through after a call to section.Load() returns a map with the keys all the same.
EDIT EDIT: Okay, there is a serious problem here. The map seems to fuck itself right after the for loop where we map the file name to it's index (section.cpp, line 66-77). When I try to search for the file in the map right after it is inserted, it can't find it. This couldn't possibly be a bug in the c++ runtime, could it??
More strange behaviour, attempting to print out keys and indexes results in this each step. I'm surprised it loads anything when I put a different file name in, this is super weird.
You're not iterating over the map here, since you don't increment it
.
Try
for(auto i : candidate.fileList)
{
std::printf("Path: %s, index: %d\n", i.first.c_str(), i.second);
}
While I'm also getting warnings about duplicates, at least the file "data/eff_tex/fire00_tr.pic" is correctly detected to be in section "tex" and "data/tmp/us11.map" to be in section "bgus". Which file are you trying to load that is mapped to the wrong section? I'm looking further into the duplicate warnings ATM.
You're not iterating over the map here, since you don't increment it.
Lol, I just realised that when I opened the project again after a few drinks.. Alcohol goes in and code comes out I guess..
Which file are you trying to load that is mapped to the wrong section?
Most files. They end up dumping _CATALOG.VIX
for some reason, I'm not sure. That or they fail to open at all and just silently fail (returning ARC_FILE_NOT_FOUND).
It would seem that LoadFile()
isn't detecting files in the map correctly. I'm not too up to date with STL stuff like iterators, so I'm not too sure if there are any issues.
diff --git a/source/main.cpp b/source/main.cpp
index 9be0896..e23c033 100644
--- a/source/main.cpp
+++ b/source/main.cpp
@@ -71,11 +71,12 @@ int main(int argc, char** argv)
std::printf("%f\n", static_cast<double>(ret.y));
// sh3_config config;
-// sh3_arc arc;
+ sh3_arc arc;
//
// arc.Load();
-// std::vector<uint8_t> data;
-// arc.LoadFile("data/eff_tex/fire00_tr.pic", data);
+ std::vector<uint8_t> data;
+ arc.LoadFile("data/eff_tex/fire00_tr.pic", data);
+ arc.LoadFile("data/tmp/us11.map", data);
//
// sh3_window* window = new sh3_window(640, 480, "SILENT HILL 3");
Those two files seem to work. Try opening data/bg/hu/hu22.kg2
and check the output. It loads _CATALOG.VIX
for some reason.
For some reason, this section of code
` for(sh3_arc_section& candidate : c_sections) {
on line 97 in 'types.cpp' incorrectly detects what section the file is in. I've verified that the names and indexes are being mapped correctly (at least I think so), but for some reason this loop detects that a LOT of files are in the
tex
section when they are definitely not. It also seems it grabs the same index when it does this.