mirror of
https://github.com/zeldaret/oot.git
synced 2024-12-01 23:36:00 +00:00
3d9db8d34d
* decompress baserom * cleanup * specific hash check * rename baserom * git subrepo clone (merge) --branch=5da3132606e4fd427a8d72b8428e4f921cd6e56f git@github.com:z64tools/z64compress.git tools/z64compress subrepo: subdir: "tools/z64compress" merged: "5da313260" upstream: origin: "git@github.com:z64tools/z64compress.git" branch: "5da3132606e4fd427a8d72b8428e4f921cd6e56f" commit: "5da313260" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * setup compression * Add all compressed segments to the spec * Update md5 files * readme instructions * cleanup * Setup python dependencies on Jenkinsfile * Update Makefile Co-authored-by: cadmic <cadmic24@gmail.com> * review * . .venv/bin/activate * update readme * whoops * Yeet other versions from decompress_baserom.py * my bad * Move everything to baseroms/VERSION/ * Active venv on each command * jenkinsfile: use multiline syntax * Put the correct path on the jenkinsfile * Forgot to call per_version_fixes * CC0 * Update readme * Change where baserom segments are put into * Update Makefile Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com> * Update crunch64 * Label compressed instead of uncompressed * Update README.md Co-authored-by: fig02 <fig02srl@gmail.com> * Fix * `make rom` * baserom-uncompressed * Update README.md Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com> * Update README.md Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com> * Update README.md Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com> * Update README.md Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com> * Update README.md Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com> * review * baserom-decompressed.z64 * ignore baseroms * rm -rf tools/z64compress * wip crunch64-based compress.py * OK compress * use ipl3checksum sum directly for cic update on compressed rom * multithreading * "docs" * fix MT: move set_sigint_ignored to global level for pickling * license compress.py * rm junk * Fix (or at least sort out) compress_ranges.txt dependencies * Update tools/overlayhelpers/damage_table.py Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com> --------- Co-authored-by: cadmic <cadmic24@gmail.com> Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com> Co-authored-by: fig02 <fig02srl@gmail.com>
94 lines
2.5 KiB
C
94 lines
2.5 KiB
C
#include <ctype.h>
|
|
#include <stdarg.h>
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#include "spec.h"
|
|
#include "util.h"
|
|
|
|
struct Segment* g_segments;
|
|
int g_segmentsCount;
|
|
|
|
static void write_dmadata_table(FILE *fout)
|
|
{
|
|
int i;
|
|
|
|
for (i = 0; i < g_segmentsCount; i++)
|
|
fprintf(fout, "DEFINE_DMA_ENTRY(%s, \"%s\")\n", g_segments[i].name, g_segments[i].name);
|
|
}
|
|
|
|
static void write_compress_ranges(FILE *fout)
|
|
{
|
|
int i;
|
|
bool continue_list = false;
|
|
int stride_first = -1;
|
|
|
|
for (i = 0; i < g_segmentsCount; i++) {
|
|
if (g_segments[i].compress) {
|
|
if (stride_first == -1)
|
|
stride_first = i;
|
|
}
|
|
if (!g_segments[i].compress || i == g_segmentsCount - 1) {
|
|
if (stride_first != -1) {
|
|
int stride_last = i - 1;
|
|
if (continue_list) {
|
|
fprintf(fout, ",");
|
|
}
|
|
if (stride_first == stride_last) {
|
|
fprintf(fout, "%d", stride_first);
|
|
} else {
|
|
fprintf(fout, "%d-%d", stride_first, stride_last);
|
|
}
|
|
continue_list = true;
|
|
stride_first = -1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
static void usage(const char *execname)
|
|
{
|
|
fprintf(stderr, "zelda64 dmadata generation tool v0.01\n"
|
|
"usage: %s SPEC_FILE DMADATA_TABLE COMPRESS_RANGES\n"
|
|
"SPEC_FILE file describing the organization of object files into segments\n"
|
|
"DMADATA_TABLE filename of output dmadata table header\n",
|
|
"COMPRESS_RANGES filename to write which files are compressed (e.g. 0-5,7,10-20)\n",
|
|
execname);
|
|
}
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
FILE *dmaout;
|
|
FILE *compress_ranges_out;
|
|
void *spec;
|
|
size_t size;
|
|
|
|
if (argc != 4)
|
|
{
|
|
usage(argv[0]);
|
|
return 1;
|
|
}
|
|
|
|
spec = util_read_whole_file(argv[1], &size);
|
|
parse_rom_spec(spec, &g_segments, &g_segmentsCount);
|
|
|
|
dmaout = fopen(argv[2], "w");
|
|
if (dmaout == NULL)
|
|
util_fatal_error("failed to open file '%s' for writing", argv[2]);
|
|
write_dmadata_table(dmaout);
|
|
fclose(dmaout);
|
|
|
|
compress_ranges_out = fopen(argv[3], "w");
|
|
if (compress_ranges_out == NULL)
|
|
util_fatal_error("failed to open file '%s' for writing", argv[3]);
|
|
write_compress_ranges(compress_ranges_out);
|
|
fclose(compress_ranges_out);
|
|
|
|
free_rom_spec(g_segments, g_segmentsCount);
|
|
free(spec);
|
|
|
|
return 0;
|
|
}
|