mirror of
https://github.com/skillbert/rsmv.git
synced 2025-12-23 21:47:48 -05:00
struct and param decoding
This commit is contained in:
12
generated/params.d.ts
vendored
Normal file
12
generated/params.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
// GENERATED DO NOT EDIT
|
||||
// This source data is located at '..\src\opcodes\params.jsonc'
|
||||
// run `npm run filetypes` to rebuild
|
||||
|
||||
export type params = {
|
||||
unk04?: true | null
|
||||
type?: {
|
||||
vartype: number,
|
||||
defaultint: number | null,
|
||||
defaultstring: string | null,
|
||||
} | null
|
||||
};
|
||||
11
generated/structs.d.ts
vendored
Normal file
11
generated/structs.d.ts
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
// GENERATED DO NOT EDIT
|
||||
// This source data is located at '..\src\opcodes\structs.jsonc'
|
||||
// run `npm run filetypes` to rebuild
|
||||
|
||||
export type structs = {
|
||||
extra?: {
|
||||
prop: number,
|
||||
intvalue: number | null,
|
||||
stringvalue: string | null,
|
||||
}[] | null
|
||||
};
|
||||
@@ -9,7 +9,6 @@ import { ThreejsSceneCache } from "./ob3tothree";
|
||||
import { sequences } from "../../generated/sequences";
|
||||
import { frames } from "../../generated/frames";
|
||||
import { BoneCenter, getBoneCenters, ModelData } from "./ob3togltf";
|
||||
import { SVD } from "svd-js";
|
||||
|
||||
//TODO remove
|
||||
// import * as THREE from "three";
|
||||
|
||||
@@ -213,6 +213,7 @@ export function indexBufferToObject(major: number, buffer: Buffer): CacheIndex[]
|
||||
const mappedFileIds = {
|
||||
[cacheMajors.items]: 256,//not sure
|
||||
[cacheMajors.npcs]: 128,
|
||||
[cacheMajors.structs]: 32,
|
||||
[cacheMajors.enums]: 256,
|
||||
[cacheMajors.objects]: 256,
|
||||
[cacheMajors.sequences]: 128,
|
||||
|
||||
@@ -10,6 +10,7 @@ export const cacheMajors = {
|
||||
items: 19,
|
||||
sequences: 20,
|
||||
spotanims: 21,
|
||||
structs: 22,
|
||||
quickchat: 24,
|
||||
materials: 26,
|
||||
worldmap: 23,
|
||||
@@ -36,6 +37,7 @@ export const cacheConfigPages = {
|
||||
mapunderlays: 1,
|
||||
identityKit: 3,
|
||||
mapoverlays: 4,
|
||||
params: 11,
|
||||
environments: 29,
|
||||
animgroups: 32,
|
||||
mapscenes: 34
|
||||
|
||||
9
src/opcodes/params.jsonc
Normal file
9
src/opcodes/params.jsonc
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"0x04": { "name": "unk04", "read": "true" },
|
||||
"0x65": { "name": "type", "read": ["struct",
|
||||
["vartype","varushort"],
|
||||
["$primitive","ubyte"],
|
||||
["defaultint",["opt",["$primitive",2],"uint"]],
|
||||
["defaultstring",["opt",["$primitive",5],"string"]]
|
||||
] }
|
||||
}
|
||||
3
src/opcodes/structs.jsonc
Normal file
3
src/opcodes/structs.jsonc
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"0xF9": { "name": "extra", "read": "extrasmap" }
|
||||
}
|
||||
@@ -70,7 +70,7 @@
|
||||
"string": { "primitive": "string", "encoding": "latin1", "termination": null, "prebytes":[] },
|
||||
"paddedstring": { "primitive": "string", "encoding": "latin1", "termination": null, "prebytes":[0] },
|
||||
|
||||
"extrasmap": [ "array",["struct",
|
||||
"extrasmap": [ "array","ubyte",["struct",
|
||||
["$type","unsigned byte"],
|
||||
["prop","unsigned tribyte"],
|
||||
["intvalue",["opt",["$type",0],"int"]],
|
||||
|
||||
@@ -78,5 +78,7 @@ export const parseQuickchatLines = new FileParser<import("../generated/quickchat
|
||||
export const parseEnvironments = new FileParser<import("../generated/environments").environments>(require("./opcodes/environments.jsonc"));
|
||||
export const parseAvatars = new FileParser<import("../generated/avatars").avatars>(require("./opcodes/avatars.jsonc"));
|
||||
export const parseIdentitykit = new FileParser<import("../generated/identitykit").identitykit>(require("./opcodes/identitykit.jsonc"));
|
||||
export const parseStructs = new FileParser<import("../generated/structs").structs>(require("./opcodes/structs.jsonc"));
|
||||
export const parseParams = new FileParser<import("../generated/params").params>(require("./opcodes/params.jsonc"));
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { run, command, number, option, string, boolean, Type, flag, oneOf, optio
|
||||
import * as fs from "fs";
|
||||
import * as path from "path";
|
||||
import { cacheConfigPages, cacheMajors, cacheMapFiles } from "../constants";
|
||||
import { parseAchievement, parseItem, parseObject, parseNpc, parseMapsquareTiles, FileParser, parseMapsquareUnderlays, parseMapsquareOverlays, parseMapZones, parseFrames, parseEnums, parseMapscenes, parseAnimgroupConfigs, parseMapsquareLocations, parseSequences, parseFramemaps, parseModels, parseRootCacheIndex, parseSpotAnims, parseCacheIndex, parseSkeletalAnim, parseMaterials, parseQuickchatCategories, parseQuickchatLines, parseEnvironments, parseAvatars, parseIdentitykit } from "../opdecoder";
|
||||
import { parseAchievement, parseItem, parseObject, parseNpc, parseMapsquareTiles, FileParser, parseMapsquareUnderlays, parseMapsquareOverlays, parseMapZones, parseFrames, parseEnums, parseMapscenes, parseAnimgroupConfigs, parseMapsquareLocations, parseSequences, parseFramemaps, parseModels, parseRootCacheIndex, parseSpotAnims, parseCacheIndex, parseSkeletalAnim, parseMaterials, parseQuickchatCategories, parseQuickchatLines, parseEnvironments, parseAvatars, parseIdentitykit, parseStructs, parseParams } from "../opdecoder";
|
||||
import { archiveToFileId, CacheFileSource, CacheIndex, fileIdToArchiveminor, SubFile } from "../cache";
|
||||
import { parseSprite } from "../3d/sprite";
|
||||
import sharp from "sharp";
|
||||
@@ -215,6 +215,7 @@ const modes: Record<string, DecodeModeFactory> = {
|
||||
npcs: standardFile(parseNpc, chunkedIndex(cacheMajors.npcs)),
|
||||
objects: standardFile(parseObject, chunkedIndex(cacheMajors.objects)),
|
||||
achievements: standardFile(parseAchievement, chunkedIndex(cacheMajors.achievements)),
|
||||
structs: standardFile(parseStructs, chunkedIndex(cacheMajors.structs)),
|
||||
sequences: standardFile(parseSequences, chunkedIndex(cacheMajors.sequences)),
|
||||
spotanims: standardFile(parseSpotAnims, chunkedIndex(cacheMajors.spotanims)),
|
||||
materials: standardFile(parseMaterials, chunkedIndex(cacheMajors.materials)),
|
||||
@@ -223,6 +224,7 @@ const modes: Record<string, DecodeModeFactory> = {
|
||||
|
||||
overlays: standardFile(parseMapsquareOverlays, singleMinorIndex(cacheMajors.config, cacheConfigPages.mapoverlays)),
|
||||
identitykit: standardFile(parseIdentitykit, singleMinorIndex(cacheMajors.config, cacheConfigPages.identityKit)),
|
||||
params: standardFile(parseParams, singleMinorIndex(cacheMajors.config, cacheConfigPages.params)),
|
||||
underlays: standardFile(parseMapsquareUnderlays, singleMinorIndex(cacheMajors.config, cacheConfigPages.mapunderlays)),
|
||||
mapscenes: standardFile(parseMapscenes, singleMinorIndex(cacheMajors.config, cacheConfigPages.mapscenes)),
|
||||
environments: standardFile(parseEnvironments, singleMinorIndex(cacheMajors.config, cacheConfigPages.environments)),
|
||||
|
||||
@@ -3,7 +3,7 @@ import { run, command, number, option, string, boolean, Type, flag, oneOf } from
|
||||
import * as fs from "fs";
|
||||
import * as path from "path";
|
||||
import { cacheConfigPages, cacheMajors, cacheMapFiles } from "../constants";
|
||||
import { parseAchievement, parseItem, parseObject, parseNpc, parseCacheIndex, parseMapsquareTiles, FileParser, parseModels, parseMapsquareUnderlays, parseSequences, parseMapsquareOverlays, parseMapZones, parseFrames, parseEnums, parseMapscenes, parseMapsquareLocations, parseFramemaps, parseAnimgroupConfigs, parseSpotAnims, parseRootCacheIndex, parseSkeletalAnim, parseMaterials, parseQuickchatLines, parseEnvironments, parseAvatars, parseIdentitykit } from "../opdecoder";
|
||||
import { parseAchievement, parseItem, parseObject, parseNpc, parseCacheIndex, parseMapsquareTiles, FileParser, parseModels, parseMapsquareUnderlays, parseSequences, parseMapsquareOverlays, parseMapZones, parseFrames, parseEnums, parseMapscenes, parseMapsquareLocations, parseFramemaps, parseAnimgroupConfigs, parseSpotAnims, parseRootCacheIndex, parseSkeletalAnim, parseMaterials, parseQuickchatLines, parseEnvironments, parseAvatars, parseIdentitykit, parseStructs, parseParams } from "../opdecoder";
|
||||
import { archiveToFileId, CacheFileSource, CacheIndex, fileIdToArchiveminor, SubFile } from "../cache";
|
||||
import { parseSprite } from "../3d/sprite";
|
||||
import sharp from "sharp";
|
||||
@@ -23,9 +23,9 @@ let cmd = command({
|
||||
},
|
||||
handler: async (args) => {
|
||||
const errdir = "./cache5/errs";
|
||||
const decoder = parseIdentitykit;
|
||||
const decoder = parseParams;
|
||||
const major = cacheMajors.config;
|
||||
const minor: number = cacheConfigPages.identityKit;
|
||||
const minor: number =cacheConfigPages.params;
|
||||
const subfileid: number = -1;
|
||||
const skipMinorAfterError = false;
|
||||
const skipFilesizeAfterError = false;
|
||||
|
||||
Reference in New Issue
Block a user