forked from mirrors/principia
Add progress-dump tool for dumping data.bin progress data
This commit is contained in:
parent
cfcc169661
commit
63d60d6a45
5 changed files with 60 additions and 1 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
SUBDIRS := featured-list-creator lvl-icon-extractor lvlbuf-decompressor lvledit package-creator progress-get
|
SUBDIRS := featured-list-creator lvl-icon-extractor lvlbuf-decompressor lvledit package-creator progress-dump progress-get
|
||||||
|
|
||||||
.PHONY: all clean $(SUBDIRS)
|
.PHONY: all clean $(SUBDIRS)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ Most of these programs rely on source files from the main Principia codebase and
|
||||||
- `lvlbuf-decompressor`: Decompress the level buffer of a Principia level file
|
- `lvlbuf-decompressor`: Decompress the level buffer of a Principia level file
|
||||||
- `lvledit`: Edit metadata of Principia level files
|
- `lvledit`: Edit metadata of Principia level files
|
||||||
- `package-creator`: Create a Principia package file from JSON data
|
- `package-creator`: Create a Principia package file from JSON data
|
||||||
|
- `progress-dump`: Dump the contents of a data.bin file to a human-readable format
|
||||||
- `progress-get`: Get leaderboard score for a given level from a data.bin file
|
- `progress-get`: Get leaderboard score for a given level from a data.bin file
|
||||||
|
|
||||||
## Kaitai Struct files
|
## Kaitai Struct files
|
||||||
|
|
|
||||||
20
utils/progress-dump/Makefile
Normal file
20
utils/progress-dump/Makefile
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
BIN = ../bin
|
||||||
|
PRINCIPIA = ../..
|
||||||
|
PROGRAM = progress-dump
|
||||||
|
SRCS := main.cc $(PRINCIPIA)/src/progress.cc
|
||||||
|
|
||||||
|
CXX ?= g++
|
||||||
|
CXXFLAGS ?= -D_NO_TMS -O2 -ffunction-sections -fdata-sections
|
||||||
|
INCLUDES ?= -I$(PRINCIPIA)/src -I$(PRINCIPIA)/lib
|
||||||
|
LDFLAGS ?= -lz -Wl,--gc-sections
|
||||||
|
|
||||||
|
all: $(BIN)/$(PROGRAM)
|
||||||
|
|
||||||
|
$(BIN)/$(PROGRAM): $(SRCS)
|
||||||
|
@mkdir -p $(BIN)
|
||||||
|
$(CXX) $(CXXFLAGS) $(INCLUDES) -o $@ $^ $(LDFLAGS)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm $(BIN)/$(PROGRAM)
|
||||||
|
|
||||||
|
.PHONY: all clean
|
||||||
8
utils/progress-dump/README.md
Normal file
8
utils/progress-dump/README.md
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
# `progress-dump`
|
||||||
|
Dump all level progress data from a `data.bin` file into a human-readable format, for debugging.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```bash
|
||||||
|
progress-dump <path-to-data-bin>
|
||||||
|
```
|
||||||
30
utils/progress-dump/main.cc
Normal file
30
utils/progress-dump/main.cc
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
#include "progress.hh"
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cstdio>
|
||||||
|
#include <ctime>
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
if (argc < 2) {
|
||||||
|
printf("usage: progress-dump <path-to-data-bin>\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
srand(time(NULL));
|
||||||
|
progress::init(argv[1]);
|
||||||
|
|
||||||
|
for (int x = 0; x < 3; x++) {
|
||||||
|
printf("Level type %d (%lu levels):\n", x, progress::levels[x].size());
|
||||||
|
for (std::map<uint32_t, lvl_progress*>::iterator i = progress::levels[x].begin();
|
||||||
|
i != progress::levels[x].end(); i++) {
|
||||||
|
uint32_t id = i->first;
|
||||||
|
lvl_progress *p = i->second;
|
||||||
|
|
||||||
|
printf(" Level ID: %u\n", id);
|
||||||
|
printf(" Completed: %s\n", p->completed ? "Yes" : "No");
|
||||||
|
printf(" Num plays: %u\n", p->num_plays);
|
||||||
|
printf(" Top score: %u\n", p->top_score);
|
||||||
|
printf(" Last score: %u\n", p->last_score);
|
||||||
|
printf(" Time: %u seconds\n", p->time);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue