mirror of
https://github.com/projectPiki/pikmin2.git
synced 2025-01-23 22:54:30 +00:00
TCamera and add context tool from @encounter
tools/decompctx.py path/to/file.cpp
This commit is contained in:
parent
87c76405d9
commit
a543941528
39
include/JStage/TCamera.h
Normal file
39
include/JStage/TCamera.h
Normal file
@ -0,0 +1,39 @@
|
||||
#ifndef _JSTAGE_TCAMERA_H
|
||||
#define _JSTAGE_TCAMERA_H
|
||||
|
||||
#include "JStage/TObject.h"
|
||||
#include "Dolphin/vec.h"
|
||||
|
||||
namespace JStage {
|
||||
typedef struct TECameraProjection;
|
||||
typedef struct TECameraView;
|
||||
struct TCamera : public TObject {
|
||||
virtual void JSGFGetType() const; // _0C
|
||||
virtual void JSGGetProjectionType() const; // _3C
|
||||
virtual void JSGSetProjectionType(TECameraProjection); // _40
|
||||
virtual void JSGGetProjectionNear() const; // _44
|
||||
virtual void JSGSetProjectionNear(float); // _48
|
||||
virtual void JSGGetProjectionFar() const; // _4C
|
||||
virtual void JSGSetProjectionFar(float); // _50
|
||||
virtual void JSGGetProjectionFovy() const; // _54
|
||||
virtual void JSGSetProjectionFovy(float); // _58
|
||||
virtual void JSGGetProjectionAspect() const; // _5C
|
||||
virtual void JSGSetProjectionAspect(float); // _60
|
||||
virtual void JSGGetProjectionField(float*) const; // _64
|
||||
virtual void JSGSetProjectionField(const float*); // _68
|
||||
virtual void JSGGetViewType() const; // _6C
|
||||
virtual void JSGSetViewType(TECameraView); // _70
|
||||
virtual void JSGGetViewPosition(Vec*) const; // _74
|
||||
virtual void JSGSetViewPosition(const Vec&); // _78
|
||||
virtual void JSGGetViewUpVector(Vec*) const; // _7C
|
||||
virtual void JSGSetViewUpVector(const Vec&); // _80
|
||||
virtual void JSGGetViewTargetPosition(Vec*) const; // _84
|
||||
virtual void JSGSetViewTargetPosition(const Vec&); // _88
|
||||
virtual void JSGGetViewRoll() const; // _8C
|
||||
virtual void JSGSetViewRoll(float); // _90
|
||||
|
||||
// _00 VTBL
|
||||
};
|
||||
} // namespace JStage
|
||||
|
||||
#endif
|
68
tools/decompctx.py
Normal file
68
tools/decompctx.py
Normal file
@ -0,0 +1,68 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import re
|
||||
|
||||
script_dir = os.path.dirname(os.path.realpath(__file__))
|
||||
root_dir = os.path.abspath(os.path.join(script_dir, ".."))
|
||||
src_dir = os.path.join(root_dir, "src")
|
||||
include_dir = os.path.join(root_dir, "include")
|
||||
|
||||
include_pattern = re.compile(r'^#include\s*[<"](.+?)[>"]$')
|
||||
guard_pattern = re.compile(r'^#ifndef\s+(.*)$')
|
||||
|
||||
defines = set()
|
||||
|
||||
def import_h_file(in_file, r_path) -> str:
|
||||
rel_path = os.path.join(root_dir, r_path, in_file)
|
||||
inc_path = os.path.join(include_dir, in_file)
|
||||
if os.path.exists(rel_path):
|
||||
return import_c_file(rel_path)
|
||||
elif os.path.exists(inc_path):
|
||||
return import_c_file(inc_path)
|
||||
else:
|
||||
print("Failed to locate", in_file)
|
||||
exit(1)
|
||||
|
||||
def import_c_file(in_file) -> str:
|
||||
in_file = os.path.relpath(in_file, root_dir)
|
||||
out_text = ''
|
||||
|
||||
with open(in_file) as file:
|
||||
for idx, line in enumerate(file):
|
||||
guard_match = guard_pattern.match(line.strip())
|
||||
if idx == 0:
|
||||
if guard_match:
|
||||
if guard_match[1] in defines:
|
||||
break
|
||||
defines.add(guard_match[1])
|
||||
print("Processing file", in_file)
|
||||
include_match = include_pattern.match(line.strip())
|
||||
if include_match:
|
||||
out_text += f"/* \"{in_file}\" line {idx} \"{include_match[1]}\" */\n"
|
||||
out_text += import_h_file(include_match[1], os.path.dirname(in_file))
|
||||
out_text += f"/* end \"{include_match[1]}\" */\n"
|
||||
else:
|
||||
out_text += line
|
||||
|
||||
return out_text
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(
|
||||
description="""Create a context file which can be used for decomp.me"""
|
||||
)
|
||||
parser.add_argument(
|
||||
"c_file",
|
||||
help="""File from which to create context""",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
output = import_c_file(args.c_file)
|
||||
|
||||
with open(os.path.join(root_dir, "ctx.c"), "w", encoding="UTF-8") as f:
|
||||
f.write(output)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
@ -1,111 +0,0 @@
|
||||
#ifndef _JSTAGE_TCAMERA_H
|
||||
#define _JSTAGE_TCAMERA_H
|
||||
|
||||
/*
|
||||
__vt__Q26JStage7TCamera:
|
||||
.4byte 0
|
||||
.4byte 0
|
||||
.4byte 0
|
||||
.4byte JSGFGetType__Q26JStage7TCameraCFv
|
||||
.4byte JSGGetName__Q26JStage7TObjectCFv
|
||||
.4byte JSGUpdate__Q26JStage7TObjectFv
|
||||
.4byte JSGGetFlag__Q26JStage7TObjectCFv
|
||||
.4byte JSGSetFlag__Q26JStage7TObjectFUl
|
||||
.4byte JSGGetData__Q26JStage7TObjectCFUlPvUl
|
||||
.4byte JSGSetData__Q26JStage7TObjectFUlPCvUl
|
||||
.4byte JSGGetParent__Q26JStage7TObjectCFPPQ26JStage7TObjectPUl
|
||||
.4byte JSGSetParent__Q26JStage7TObjectFPQ26JStage7TObjectUl
|
||||
.4byte JSGSetRelation__Q26JStage7TObjectFbPQ26JStage7TObjectUl
|
||||
.4byte JSGFindNodeID__Q26JStage7TObjectCFPCc
|
||||
.4byte JSGGetNodeTransformation__Q26JStage7TObjectCFUlPA4_f
|
||||
.4byte JSGGetProjectionType__Q26JStage7TCameraCFv
|
||||
.4byte JSGSetProjectionType__Q26JStage7TCameraFQ26JStage18TECameraProjection
|
||||
.4byte JSGGetProjectionNear__Q26JStage7TCameraCFv
|
||||
.4byte JSGSetProjectionNear__Q26JStage7TCameraFf
|
||||
.4byte JSGGetProjectionFar__Q26JStage7TCameraCFv
|
||||
.4byte JSGSetProjectionFar__Q26JStage7TCameraFf
|
||||
.4byte JSGGetProjectionFovy__Q26JStage7TCameraCFv
|
||||
.4byte JSGSetProjectionFovy__Q26JStage7TCameraFf
|
||||
.4byte JSGGetProjectionAspect__Q26JStage7TCameraCFv
|
||||
.4byte JSGSetProjectionAspect__Q26JStage7TCameraFf
|
||||
.4byte JSGGetProjectionField__Q26JStage7TCameraCFPf
|
||||
.4byte JSGSetProjectionField__Q26JStage7TCameraFPCf
|
||||
.4byte JSGGetViewType__Q26JStage7TCameraCFv
|
||||
.4byte JSGSetViewType__Q26JStage7TCameraFQ26JStage12TECameraView
|
||||
.4byte JSGGetViewPosition__Q26JStage7TCameraCFP3Vec
|
||||
.4byte JSGSetViewPosition__Q26JStage7TCameraFRC3Vec
|
||||
.4byte JSGGetViewUpVector__Q26JStage7TCameraCFP3Vec
|
||||
.4byte JSGSetViewUpVector__Q26JStage7TCameraFRC3Vec
|
||||
.4byte JSGGetViewTargetPosition__Q26JStage7TCameraCFP3Vec
|
||||
.4byte JSGSetViewTargetPosition__Q26JStage7TCameraFRC3Vec
|
||||
.4byte JSGGetViewRoll__Q26JStage7TCameraCFv
|
||||
.4byte JSGSetViewRoll__Q26JStage7TCameraFf
|
||||
.4byte 0
|
||||
*/
|
||||
|
||||
namespace JStage {
|
||||
struct TObject {
|
||||
virtual void _00() = 0; // _00
|
||||
virtual void JSGFGetType() const; // _04
|
||||
virtual void JSGGetName() const; // _08
|
||||
virtual void JSGUpdate(); // _0C
|
||||
virtual void JSGGetFlag() const; // _10
|
||||
virtual void JSGSetFlag(unsigned long); // _14
|
||||
virtual void JSGGetData(unsigned long, void*, unsigned long) const; // _18
|
||||
virtual void JSGSetData(unsigned long, const void*, unsigned long); // _1C
|
||||
virtual void JSGGetParent(TObject**, unsigned long*) const; // _20
|
||||
virtual void JSGSetParent(TObject*, unsigned long); // _24
|
||||
virtual void JSGSetRelation(bool, TObject*, unsigned long); // _28
|
||||
virtual void JSGFindNodeID(const char*) const; // _2C
|
||||
virtual void JSGGetNodeTransformation(unsigned long,
|
||||
float (*)[4]) const; // _30
|
||||
|
||||
// _00 VTBL
|
||||
};
|
||||
} // namespace JStage
|
||||
|
||||
namespace JStage {
|
||||
struct TCamera : public TObject {
|
||||
virtual void _00() = 0; // _00
|
||||
virtual void JSGFGetType() const; // _04
|
||||
virtual void JSGGetName() const; // _08
|
||||
virtual void JSGUpdate(); // _0C
|
||||
virtual void JSGGetFlag() const; // _10
|
||||
virtual void JSGSetFlag(unsigned long); // _14
|
||||
virtual void JSGGetData(unsigned long, void*, unsigned long) const; // _18
|
||||
virtual void JSGSetData(unsigned long, const void*, unsigned long); // _1C
|
||||
virtual void JSGGetParent(TObject**, unsigned long*) const; // _20
|
||||
virtual void JSGSetParent(TObject*, unsigned long); // _24
|
||||
virtual void JSGSetRelation(bool, TObject*, unsigned long); // _28
|
||||
virtual void JSGFindNodeID(const char*) const; // _2C
|
||||
virtual void JSGGetNodeTransformation(unsigned long,
|
||||
float (*)[4]) const; // _30
|
||||
virtual void JSGGetProjectionType() const; // _34
|
||||
virtual void JSGSetProjectionType(TECameraProjection); // _38
|
||||
virtual void JSGGetProjectionNear() const; // _3C
|
||||
virtual void JSGSetProjectionNear(float); // _40
|
||||
virtual void JSGGetProjectionFar() const; // _44
|
||||
virtual void JSGSetProjectionFar(float); // _48
|
||||
virtual void JSGGetProjectionFovy() const; // _4C
|
||||
virtual void JSGSetProjectionFovy(float); // _50
|
||||
virtual void JSGGetProjectionAspect() const; // _54
|
||||
virtual void JSGSetProjectionAspect(float); // _58
|
||||
virtual void JSGGetProjectionField(float*) const; // _5C
|
||||
virtual void JSGSetProjectionField(const float*); // _60
|
||||
virtual void JSGGetViewType() const; // _64
|
||||
virtual void JSGSetViewType(TECameraView); // _68
|
||||
virtual void JSGGetViewPosition(Vec*) const; // _6C
|
||||
virtual void JSGSetViewPosition(const Vec&); // _70
|
||||
virtual void JSGGetViewUpVector(Vec*) const; // _74
|
||||
virtual void JSGSetViewUpVector(const Vec&); // _78
|
||||
virtual void JSGGetViewTargetPosition(Vec*) const; // _7C
|
||||
virtual void JSGSetViewTargetPosition(const Vec&); // _80
|
||||
virtual void JSGGetViewRoll() const; // _84
|
||||
virtual void JSGSetViewRoll(float); // _88
|
||||
virtual void _8C() = 0; // _8C
|
||||
|
||||
// _00 VTBL
|
||||
};
|
||||
} // namespace JStage
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user