Ongoing gameplay dev (#49)

* launch.json cwd

* bodge to load gci for testing

* stub card stat

* gameplay bodges

* viewport, ub fixes

* add release with debug info cmake variant

* be fixes, sound stub

* viewport h

* d_msg_flow BE

* be fopAcM_createItemFromEnemyID

* update launch configuration to use iso

* more audio stubs

* Attempt to set viewport and get messages for brightness check

* skip opening scene again, fixed JMessage::TResourceContainer::TCResource::Do_destroy

* add guards for viewport changes

* moar endian swapping to get Link sitting in PROC_OPENING_SCENE and for dialogues

* BE d_msg_class i_data

* stub bgm start

* fix div by 0 error (for now)

* TEMP_BROKEN in d_menu_ring

* REQUIRES_GX_LINES

* properly stub renderingAmap::draw with REQUIRES_GX_LINES

* better stubbing outside of stubs

* fix event data getting swapped multiple times

* evil draw vp fix

* Stub log imgui

This redirects all spammy logs to an imgui window that is cleared per frame.

This fixes the serious performance dip of the logging, and makes the regular log readable.

* Oops move those optimization changes I accidentally committed behind a flag

DUSK_SELECTED_OPT

* gx_line macro in map

* fix audio stubbing

* switch to CARD API aurora impl

* remove kabufuda from link libs

* refactor imgui stuff and add input viewer

* merge stub log with refactor

* accidentally committed a metaforce header shh

* basic map loader

* ImGuiConsole: Add missing <thread> include

* you may now play as luigi (you may now load stages with bridges)

* bloom fix

* bloom leak fix

* cloud shadow fix

* add soft reset button to imgui menu

* if it broke dont not fix it

* i swear i committed this

* BE swap indMtx in JPAResource::setPTev

* wnark ct fix

* frsqrte implementation from kinoko

* Fix Clang compile error in JAISeq::prepare_getSeqData_

* Add endian conversions to dMsgFlow_c::getInitNodeIndex

This fixes a freeze when Fado tries to stop you from leaving the
starting area.

* Add RAII GXTexObj wrapper; fix almost all leaks

* Update aurora for indirect texturing

* Update aurora for CARD fix

* Fix Clang build

* More d_msg_flow endian fixes

Fixes softlock when trying to talk to Fado and possibly other NPCs.

* no frame limiter

* get pause menu working

* proper frame limiting

* particle pointer size fix

* improve map loader a bit

---------

Co-authored-by: Jasper St. Pierre <jstpierre@mecheye.net>
Co-authored-by: TakaRikka <takarikka@outlook.com>
Co-authored-by: CraftyBoss <talibabdulmaalik@gmail.com>
Co-authored-by: Luke Street <luke@street.dev>
Co-authored-by: Lurs <2795933+Lurs@users.noreply.github.com>
Co-authored-by: PJB3005 <pieterjan.briers+git@gmail.com>
Co-authored-by: tgsm <doodrabbit@hotmail.com>
Co-authored-by: Max Roncace <me@caseif.net>
Co-authored-by: Phillip Stephens <antidote.crk@gmail.com>
This commit is contained in:
qwertyquerty
2026-03-12 04:01:03 -07:00
committed by GitHub
parent 15732e241c
commit 767ba3bb14
129 changed files with 2270 additions and 1541 deletions
+3 -1
View File
@@ -6,10 +6,12 @@
"type": "cppvsdbg",
"request": "launch",
"program": "${command:cmake.launchTargetPath}",
"args": ["-l", "1", "--dvd", "${workspaceRoot}/orig/GZ2E01/GZ2E01.iso"],
"MIMode": "gdb",
"miDebuggerPath": "gdb",
"symbolSearchPath": "${command:cmake.launchTargetPath}",
"console": "integratedTerminal"
"console": "integratedTerminal",
"cwd":"${workspaceRoot}"
}
]
}
+27 -5
View File
@@ -14,9 +14,11 @@ if (CMAKE_SYSTEM_NAME STREQUAL Linux)
set(DAWN_USE_WAYLAND ON CACHE BOOL "Enable support for Wayland surface" FORCE)
endif ()
set(AURORA_ENABLE_DVD ON CACHE BOOL "Enable DVD API support" FORCE)
set(AURORA_ENABLE_CARD ON CACHE BOOL "Enable CARD API support" FORCE)
add_subdirectory(extern/aurora EXCLUDE_FROM_ALL)
option(DUSK_BUILD_WARNINGS "If off, compiler warnings will be suppressed")
option(DUSK_SELECTED_OPT "If on, selected parts of the project will be compiled with optimizations on Debug, intending to make the game run at 30 FPS. Note for MSVC: you will need to remove '/RTC1' from your debug flags in CMake.")
if (CMAKE_SYSTEM_NAME STREQUAL Linux)
# -Wno-multichar: Multi-character constants ('ABCD') are implementation-defined but all compilers
@@ -64,7 +66,15 @@ FetchContent_MakeAvailable(cxxopts)
include(files.cmake)
# TODO: version handling for res includes
set(DUSK_TP_VERSION GZ2E01)
set(DUSK_GAME_NAME "GZ2E")
set(DUSK_GAME_VERSION "01")
set(DUSK_TP_VERSION ${DUSK_GAME_NAME}${DUSK_GAME_VERSION})
message(STATUS "dusk: Game Name: ${DUSK_GAME_NAME}")
message(STATUS "dusk: Game Version: ${DUSK_GAME_VERSION}")
message(STATUS "dusk: TP Version: ${DUSK_TP_VERSION}")
source_group("dolzel" FILES ${DOLZEL_FILES} ${Z2AUDIOLIB_FILES} ${JSYSTEM_FILES} ${JSYSTEM_DEBUG_FILES} ${REL_FILES})
source_group("dusk" FILES ${DUSK_FILES})
@@ -84,14 +94,15 @@ target_include_directories(game_debug PUBLIC
extern
${CMAKE_SOURCE_DIR}/build/${DUSK_TP_VERSION}/include
build/${DUSK_TP_VERSION}/include)
target_link_libraries(game_debug PUBLIC aurora::core aurora::gx aurora::gd aurora::si aurora::vi aurora::pad aurora::mtx aurora::os aurora::dvd)
target_link_libraries(game_debug PUBLIC aurora::core aurora::gx aurora::gd aurora::si aurora::vi aurora::pad aurora::mtx aurora::os aurora::dvd aurora::card)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
add_library(game SHARED ${DOLZEL_FILES} ${Z2AUDIOLIB_FILES} ${SSYSTEM_FILES} ${JSYSTEM_FILES} ${REL_FILES} ${DUSK_FILES} ${DOLPHIN_FILES})
add_library(game SHARED ${DOLZEL_FILES} ${Z2AUDIOLIB_FILES} ${SSYSTEM_FILES} ${JSYSTEM_FILES} ${REL_FILES} ${DUSK_FILES} ${DOLPHIN_FILES}
src/dusk/imgui/ImGuiStubLog.cpp)
target_link_libraries(game PRIVATE game_debug cxxopts::cxxopts)
target_compile_definitions(game PRIVATE TARGET_PC AVOID_UB=1 VERSION=0 NDEBUG=1 NDEBUG_DEFINED=1 DEBUG_DEFINED=0)
target_compile_definitions(game PRIVATE TARGET_PC AVOID_UB=1 VERSION=0 NDEBUG=1 NDEBUG_DEFINED=1 DEBUG_DEFINED=0
DUSK_TP_VERSION="${DUSK_TP_VERSION}" DUSK_GAME_NAME="${DUSK_GAME_NAME}" DUSK_GAME_VERSION="${DUSK_GAME_VERSION}")
add_executable(dusk src/dusk/main.cpp)
target_compile_definitions(dusk PRIVATE TARGET_PC AVOID_UB=1 VERSION=0)
target_include_directories(dusk PRIVATE include)
@@ -99,3 +110,14 @@ target_link_libraries(dusk PRIVATE game aurora::main)
include(extern/aurora/cmake/AuroraCopyRuntimeDLLs.cmake)
aurora_copy_runtime_dlls(dusk game)
if (DUSK_SELECTED_OPT)
if (CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")
set(_opt_flags /O2 /Ob2)
elseif (CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "GNU")
set(_opt_flags -O2)
endif ()
target_compile_options(xxhash PRIVATE ${_opt_flags})
target_compile_options(aurora_gx PRIVATE ${_opt_flags})
endif ()
+4
View File
@@ -9,6 +9,10 @@ buildType:
short: Release
long: Optimized, no debug symbols
buildType: Release
release_debug:
short: RelWithDebInfo
long: Optimized, with debug symbols
buildType: RelWithDebInfo
platform:
default: win64
+1 -1
+9 -7
View File
@@ -1327,7 +1327,6 @@ set(DOLPHIN_FILES
set(DUSK_FILES
include/dusk/endian_gx.hpp
src/dusk/asserts.cpp
src/dusk/imgui.cpp
src/dusk/logging.cpp
src/dusk/stubs.cpp
src/dusk/endian.cpp
@@ -1335,12 +1334,15 @@ set(DUSK_FILES
src/dusk/extras.cpp
src/dusk/globals.cpp
#src/dusk/m_Do_ext_dusk.cpp
src/dusk/imgui/imgui.hpp
src/dusk/imgui/processes.cpp
src/dusk/imgui/camera.cpp
src/dusk/imgui/debug_overlay.cpp
src/dusk/imgui/heaps.cpp
src/dusk/imgui/kb_pad.cpp
src/dusk/imgui/ImGuiConsole.hpp
src/dusk/imgui/ImGuiConsole.cpp
src/dusk/imgui/ImGuiProcessOverlay.cpp
src/dusk/imgui/ImGuiCameraOverlay.cpp
src/dusk/imgui/ImGuiHeapOverlay.cpp
src/dusk/imgui/ImGuiDebugPad.cpp
src/dusk/imgui/ImGuiControllerOverlay.cpp
src/dusk/imgui/ImGuiStubLog.cpp
src/dusk/imgui/ImGuiMapLoader.cpp
src/dusk/offset_ptr.cpp
src/dusk/OSContext.cpp
src/dusk/OSThread.cpp
+2 -2
View File
@@ -15,10 +15,10 @@ public:
virtual void draw();
virtual ~dMirror_packet_c();
cXyz& getViewScale() { return mViewScale; }
GXTexObj& getTexObj() { return mTexObj; }
TGXTexObj& getTexObj() { return mTexObj; }
cXyz* getQuad() { return mQuad; }
/* 0x010 */ GXTexObj mTexObj;
/* 0x010 */ TGXTexObj mTexObj;
/* 0x030 */ u8 mModelCount;
/* 0x034 */ J3DModel* mModels[0x40];
/* 0x134 */ cXyz mQuad[4];
+2 -2
View File
@@ -35,11 +35,11 @@ public:
void setDecayRate(f32 rate) { mDecayRate = rate; }
void setGravity(f32 rate) { mGravity = rate; }
void setTornado(f32 tornado) { mTornado = tornado; }
GXTexObj* getImageTexObj() { return &mTexObj; }
TGXTexObj* getImageTexObj() { return &mTexObj; }
void setTexCoord_p(void* texCoordP) { mpTexCoord = texCoordP; }
/* 0x010 */ dKy_tevstr_c mTevStr;
/* 0x398 */ GXTexObj mTexObj;
/* 0x398 */ TGXTexObj mTexObj;
/* 0x3B8 */ dCcD_Stts mStts;
/* 0x3F4 */ dCcD_Sph mSph;
/* 0x52C */ u8 field_0x52c[0x540 - 0x52c];
+2 -2
View File
@@ -34,7 +34,7 @@ public:
cXyz* getVec() { return mVecs; }
cXyz* getNormal() { return mNormals; }
cXyz* getNormalBack() { return mNormalBacks; }
GXTexObj* getImageTexObj() { return &mTexObj; }
TGXTexObj* getImageTexObj() { return &mTexObj; }
void setSpringRate(f32 rate) { mSpringRate = rate; }
void setWindRate(f32 rate) { mWindRate = rate; }
void setDecayRate(f32 rate) { mDecayRate = rate; }
@@ -52,7 +52,7 @@ public:
void calcFlagFactorSub(cXyz* param_1, cXyz* param_2, cXyz* param_3, f32 param_4);
/* 0x010 */ GXTexObj mTexObj;
/* 0x010 */ TGXTexObj mTexObj;
/* 0x030 */ dKy_tevstr_c mTevStr;
/* 0x3B8 */ dCcD_Stts mStts;
/* 0x3F4 */ dCcD_Sph mSph;
+1 -1
View File
@@ -47,7 +47,7 @@ public:
mpBrkAnm->entry(model->getModelData());
mpMorfSO->entryDL();
if (field_0x9c0 == 0) {
GXTexObj* texObj = dDlst_shadowControl_c::getSimpleTex();
TGXTexObj* texObj = dDlst_shadowControl_c::getSimpleTex();
dComIfGd_setSimpleShadow(&current.pos, mObjAcch.GetGroundH(), 15.0f, mObjAcch.m_gnd, 0, -0.6f, texObj);
}
}
+1 -1
View File
@@ -25,7 +25,7 @@ public:
private:
/* 0x0568 */ request_of_phase_process_class mpPhase;
/* 0x0570 */ GXTexObj mTexObj;
/* 0x0570 */ TGXTexObj mTexObj;
/* 0x0590 */ dBgS_ObjAcch mObjAcch;
/* 0x0768 */ dBgS_AcchCir mAcchCir;
/* 0x07A8 */ dCcD_Stts mStts;
+3 -3
View File
@@ -1251,10 +1251,10 @@ int dComLbG_PhaseHandler(request_of_phase_process_class*, request_of_phase_proce
BOOL dComIfG_isSceneResetButton();
int dComIfGd_setSimpleShadow(cXyz* i_pos, f32 param_1, f32 param_2, cBgS_PolyInfo& param_3, s16 i_angle,
f32 param_5, GXTexObj* i_tex);
f32 param_5, TGXTexObj* i_tex);
int dComIfGd_setShadow(u32 param_0, s8 param_1, J3DModel* param_2, cXyz* param_3, f32 param_4,
f32 param_5, f32 param_6, f32 param_7, cBgS_PolyInfo& param_8,
dKy_tevstr_c* param_9, s16 param_10, f32 param_11, GXTexObj* param_12);
dKy_tevstr_c* param_9, s16 param_10, f32 param_11, TGXTexObj* param_12);
inline dSv_info_c* dComIfGs_getSaveInfo() {
return &g_dComIfG_gameInfo.info;
@@ -4489,7 +4489,7 @@ inline int dComIfGd_setRealShadow(u32 param_0, s8 param_1, J3DModel* param_2, cX
}
inline int dComIfGd_setSimpleShadow(cXyz* pos, f32 param_1, f32 param_2, cXyz* param_3, s16 angle,
f32 param_5, GXTexObj* tex) {
f32 param_5, TGXTexObj* tex) {
return g_dComIfG_gameInfo.drawlist.setSimpleShadow(pos, param_1, param_2, param_3, angle,
param_5, tex);
}
+10 -9
View File
@@ -5,9 +5,10 @@
#include "JSystem/J2DGraph/J2DScreen.h"
#include "JSystem/J3DGraphBase/J3DSys.h"
#include "SSystem/SComponent/c_m3d_g_pla.h"
#include "dusk/gx_helper.h"
#include "f_op/f_op_view.h"
#include "m_Do/m_Do_ext.h"
#include "global.h"
#include "m_Do/m_Do_ext.h"
class J3DDrawBuffer;
class J3DModel;
@@ -168,7 +169,7 @@ public:
void setScaleX(f32 scale) { mScaleX = scale; }
void setScaleY(f32 scale) { mScaleY = scale; }
/* 0x04 */ GXTexObj mTexObj;
/* 0x04 */ TGXTexObj mTexObj;
/* 0x24 */ f32 field_0x24;
/* 0x28 */ f32 field_0x28;
/* 0x2C */ f32 field_0x2c;
@@ -201,11 +202,11 @@ public:
class dDlst_shadowSimple_c {
public:
void draw();
void set(cXyz*, f32, f32, cXyz*, s16, f32, GXTexObj*);
void set(cXyz*, f32, f32, cXyz*, s16, f32, TGXTexObj*);
dDlst_shadowSimple_c();
/* 0x00 */ u8 mAlpha;
/* 0x04 */ GXTexObj* mpTexObj;
/* 0x04 */ TGXTexObj* mpTexObj;
/* 0x08 */ Mtx mVolumeMtx;
/* 0x38 */ Mtx mMtx;
}; // Size: 0x68
@@ -291,12 +292,12 @@ public:
void draw(f32 (*)[4]);
int setReal(u32, s8, J3DModel*, cXyz*, f32, f32, dKy_tevstr_c*);
bool addReal(u32, J3DModel*);
int setSimple(cXyz*, f32, f32, cXyz*, s16, f32, GXTexObj*);
int setSimple(cXyz*, f32, f32, cXyz*, s16, f32, TGXTexObj*);
static void setSimpleTex(ResTIMG const*);
static GXTexObj* getSimpleTex() { return &mSimpleTexObj; }
static TGXTexObj* getSimpleTex() { return &mSimpleTexObj; }
static GXTexObj mSimpleTexObj;
static TGXTexObj mSimpleTexObj;
private:
/* 0x00000 */ u8 field_0x0;
@@ -307,7 +308,7 @@ private:
/* 0x0000C */ dDlst_shadowSimple_c mSimple[128];
/* 0x0340C */ int mNextID;
/* 0x03410 */ dDlst_shadowReal_c mReal[8];
/* 0x15EB0 */ GXTexObj field_0x15eb0[2];
/* 0x15EB0 */ TGXTexObj field_0x15eb0[2];
/* 0x15EF0 */ void* field_0x15ef0[2];
};
@@ -444,7 +445,7 @@ public:
}
int setSimpleShadow(cXyz* param_0, f32 param_1, f32 param_2, cXyz* param_3, s16 param_4,
f32 param_5, GXTexObj* param_6) {
f32 param_5, TGXTexObj* param_6) {
return mShadowControl.setSimple(param_0, param_1, param_2, param_3, param_4, param_5,
param_6);
}
+2 -2
View File
@@ -246,7 +246,7 @@ struct dMpath_n {
void remove();
~dTexObjAggregate_c() { remove(); };
GXTexObj* getTexObjPointer(int i_no) {
TGXTexObj* getTexObjPointer(int i_no) {
JUT_ASSERT(44, i_no >= 0 && i_no < TEX_OBJ_NUMBER);
return mp_texObj[i_no];
}
@@ -257,7 +257,7 @@ struct dMpath_n {
}
}
/* 0x0 */ GXTexObj* mp_texObj[TEX_OBJ_NUMBER];
/* 0x0 */ TGXTexObj* mp_texObj[TEX_OBJ_NUMBER];
};
static dTexObjAggregate_c m_texObjAgg;
+4 -4
View File
@@ -18,11 +18,11 @@
class JMSMesgEntry_c {
public:
/* 0x0 */ u32 string_offset;
/* 0x0 */ BE(u32) string_offset;
// Attributes
/* 0x04 */ u16 message_id;
/* 0x06 */ u16 event_label_id;
/* 0x04 */ BE(u16) message_id;
/* 0x06 */ BE(u16) event_label_id;
/* 0x08 */ u8 se_speaker;
/* 0x09 */ u8 fuki_kind;
/* 0x0A */ u8 output_type;
@@ -33,7 +33,7 @@ public:
/* 0x0F */ u8 camera_id;
/* 0x10 */ u8 base_anm_id;
/* 0x11 */ u8 face_anm_id;
/* 0x12 */ u16 unk_0x12;
/* 0x12 */ BE(u16) unk_0x12;
};
class JMSMesgInfo_c {
+10 -9
View File
@@ -2,6 +2,7 @@
#define D_MSG_D_MSG_FLOW_H
#include <types.h>
#include "dusk/endian.h"
enum {
NODETYPE_MESSAGE_e = 1,
@@ -22,23 +23,23 @@ struct msg_class;
struct mesg_flow_node {
/* 0x00 */ u8 type;
/* 0x01 */ u8 field_0x1;
/* 0x02 */ u16 msg_index;
/* 0x04 */ u16 next_node_idx;
/* 0x06 */ u16 unk_0x6;
/* 0x02 */ BE(u16) msg_index;
/* 0x04 */ BE(u16) next_node_idx;
/* 0x06 */ BE(u16) unk_0x6;
}; // Size: 0x8
struct mesg_flow_node_branch {
/* 0x00 */ u8 type;
/* 0x01 */ u8 field_0x1;
/* 0x02 */ u16 query_idx;
/* 0x04 */ u16 param;
/* 0x06 */ u16 next_node_idx;
/* 0x02 */ BE(u16) query_idx;
/* 0x04 */ BE(u16) param;
/* 0x06 */ BE(u16) next_node_idx;
};
struct mesg_flow_node_event {
/* 0x00 */ u8 type;
/* 0x01 */ u8 event_idx;
/* 0x02 */ u16 next_node_idx;
/* 0x02 */ BE(u16) next_node_idx;
/* 0x04 */ u8 params[4];
}; // Size: 0x8
@@ -197,8 +198,8 @@ private:
}* mFlowNodeTBL;
/* 0x10 */ u16 mNodeIdx;
/* 0x12 */ u16 field_0x12;
/* 0x14 */ u16* mFlowIdxTBL;
/* 0x18 */ u16* field_0x18;
/* 0x14 */ BE(u16)* mFlowIdxTBL;
/* 0x18 */ BE(u16)* field_0x18;
/* 0x1C */ u16 mFlow;
/* 0x20 */ u32 mMsg;
/* 0x24 */ u8 mSelectMessage;
-1
View File
@@ -237,7 +237,6 @@ void be_swap(T (& val)[N]) {
for (u32 i = 0; i < N; i++) {
be_swap(val[i]);
}
val = BE<T>::swap(val);
}
template<typename T>
+32
View File
@@ -1,7 +1,10 @@
#ifndef DUSK_GX_HELPER_H
#define DUSK_GX_HELPER_H
#include <cstring>
#include <dolphin/gx/GXAurora.h>
#include <dolphin/gx/GXExtra.h>
#define GX_DEBUG_GROUP(name, ...) \
do { \
@@ -10,4 +13,33 @@
GXPopDebugGroup(); \
} while (0)
#ifdef TARGET_PC
class GXTexObjRAII : public GXTexObj {
public:
GXTexObjRAII() : GXTexObj() {}
~GXTexObjRAII() { GXDestroyTexObj(this); }
void reset() { GXDestroyTexObj(this); }
GXTexObjRAII(const GXTexObjRAII&) = delete;
GXTexObjRAII& operator=(const GXTexObjRAII&) = delete;
GXTexObjRAII(GXTexObjRAII&& o) = delete;/*noexcept : GXTexObj(o) {
std::memset(static_cast<GXTexObj*>(&o), 0, sizeof(GXTexObj));
}*/
GXTexObjRAII& operator=(GXTexObjRAII&& o) = delete;/*noexcept {
if (this != &o) {
GXDestroyTexObj(this);
std::memcpy(static_cast<GXTexObj*>(this), &o, sizeof(GXTexObj));
std::memset(static_cast<GXTexObj*>(&o), 0, sizeof(GXTexObj));
}
return *this;
}*/
};
static_assert(sizeof(GXTexObjRAII) == sizeof(GXTexObj),
"GXTexObjRAII should have the same size as GXTexObj");
typedef GXTexObjRAII TGXTexObj;
#else
typedef GXTexObj TGXTexObj;
#endif
#endif // DUSK_GX_HELPER_H
+15
View File
@@ -6,8 +6,23 @@
void aurora_log_callback(AuroraLogLevel level, const char* module, const char* message, unsigned int len);
namespace dusk {
void SendToStubLog(AuroraLogLevel level, const char* module, const char* message);
}
extern bool StubLogEnabled;
extern aurora::Module DuskLog;
#define STUB_LOG() DuskLog.debug("{} is a stub", __FUNCTION__)
#if TARGET_PC
#define STUB_RET(...) \
STUB_LOG(); \
return __VA_ARGS__;
#else
#define STUB_RET() (void)0
#endif
#endif
+179
View File
@@ -0,0 +1,179 @@
#pragma once
struct MapEntry {
static constexpr int MAX_ROOMS = 50;
const char* mapName;
const char* mapFile;
u8 mapRooms[MAX_ROOMS] = {};
int numRooms;
constexpr MapEntry() : mapName(nullptr), mapFile(nullptr), numRooms(0) {}
constexpr MapEntry(const MapEntry& other) = default;
template <int N>
constexpr MapEntry(const char* mapName, const char* mapFile, const int (&rooms)[N], const char*) : mapName(mapName),
mapFile(mapFile), numRooms(N) {
static_assert(N <= MAX_ROOMS);
for (int i = 0; i < N; i++) {
mapRooms[i] = rooms[i];
}
}
template <int N>
constexpr MapEntry(const char* mapName, const char* mapFile, const int (&rooms)[N]) :
mapName(mapName), mapFile(mapFile), numRooms(N) {
static_assert(N <= MAX_ROOMS);
for (int i = 0; i < N; i++) {
mapRooms[i] = rooms[i];
}
}
constexpr MapEntry(const char* mapName, const char* mapFile) : mapName(mapName),
mapFile(mapFile), numRooms(0) {}
};
struct RegionEntry {
static constexpr int MAX_MAPS = 22;
const char* regionName = nullptr;
int numMaps = 0;
MapEntry maps[MAX_MAPS] = {};
template <int N>
constexpr RegionEntry(const char* regionName, const MapEntry (&maps)[N]) : regionName(regionName), numMaps(N) {
static_assert(N <= MAX_MAPS);
for (int i = 0; i < N; i++) {
this->maps[i] = maps[i];
}
}
};
constexpr auto gameRegions = std::to_array({
RegionEntry("Hyrule Field", {
MapEntry("Hyrule Field", "F_SP121", {0, 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15}),
}), RegionEntry("Ordon", {
MapEntry("Ordon Village", "F_SP103"),
MapEntry("Outside Link's House", "F_SP103", {1}, "F_SP103_1"),
MapEntry("Ordon Ranch", "F_SP00"),
MapEntry("Ordon Spring", "F_SP104", {1}),
MapEntry("Bo's House", "R_SP01", {0}),
MapEntry("Sera's Sundries", "R_SP01", {1}, "R_SP01_1"),
MapEntry("Jaggle's House", "R_SP01", {2}, "R_SP01_2"),
MapEntry("Link's House", "R_SP01", {4, 7}, "R_SP01_4"),
MapEntry("Rusl's House", "R_SP01", {5}, "R_SP01_5"),
}), RegionEntry("Faron", {
MapEntry("South Faron Woods", "F_SP108", {0, 1, 2, 3, 4, 5, 8, 11, 14}),
MapEntry("North Faron Woods", "F_SP108", {6}, "F_SP108"),
MapEntry("Lost Woods", "F_SP117", {3}),
MapEntry("Sacred Grove", "F_SP117", {1}, "F_SP117_1"),
MapEntry("Temple of Time (Past)", "F_SP117", {2}, "F_SP117_2"),
MapEntry("Faron Woods Cave", "D_SB10"),
MapEntry("Coro's House", "R_SP108"),
}), RegionEntry("Eldin", {
MapEntry("Kakariko Village", "F_SP109"),
MapEntry("Death Mountain Trail", "F_SP110", {0, 1, 2, 3}),
MapEntry("Kakariko Graveyard", "F_SP111"),
MapEntry("Hidden Village", "F_SP128"),
MapEntry("Renado's Sanctuary", "R_SP109", {0}),
MapEntry("Sanctuary Basement", "R_SP209", {7}),
MapEntry("Barnes' Bombs", "R_SP109", {1}, "R_SP109_1"),
MapEntry("Elde Inn", "R_SP109", {2}, "R_SP109_2"),
MapEntry("Malo Mart", "R_SP109", {3}, "R_SP109_3"),
MapEntry("Lookout Tower", "R_SP109", {4}, "R_SP109_4"),
MapEntry("Bomb Warehouse", "R_SP109", {5}, "R_SP109_5"),
MapEntry("Abandoned House", "R_SP109", {6}, "R_SP109_6"),
MapEntry("Goron Elder's Hall", "R_SP110"),
}), RegionEntry("Lanayru", {
MapEntry("Outside Castle Town - West", "F_SP122", {8}),
MapEntry("Outside Castle Town - South", "F_SP122", {16}, "F_SP122_16"),
MapEntry("Outside Castle Town - East", "F_SP122", {17}, "F_SP122_17"),
MapEntry("Castle Town", "F_SP116", {0, 1, 2, 3, 4}),
MapEntry("Zora's River", "F_SP112", {1}),
MapEntry("Zora's Domain", "F_SP113", {0, 1}),
MapEntry("Lake Hylia", "F_SP115"),
MapEntry("Lanayru Spring", "F_SP115", {1}, "F_SP115_1"),
MapEntry("Upper Zora's River", "F_SP126", {0}),
MapEntry("Fishing Pond", "F_SP127", {0}),
MapEntry("Castle Town Sewers", "R_SP107", {0, 1, 2, 3}),
MapEntry("Telma's Bar / Secret Passage", "R_SP116", {5, 6}),
MapEntry("Hena's Cabin", "R_SP127", {0}),
MapEntry("Impaz's House", "R_SP128", {0}),
MapEntry("Malo Mart", "R_SP160", {0}),
MapEntry("Fanadi's Palace", "R_SP160", {1}, "R_SP160_1"),
MapEntry("Medical Clinic", "R_SP160", {2}, "R_SP160_2"),
MapEntry("Agitha's Castle", "R_SP160", {3}, "R_SP160_3"),
MapEntry("Goron Shop", "R_SP160", {4}, "R_SP160_4"),
MapEntry("Jovani's House", "R_SP160", {5}, "R_SP160_5"),
MapEntry("STAR Tent", "R_SP161", {7}),
}), RegionEntry("Gerudo Desert", {
MapEntry("Bulblin Camp", "F_SP118", {0, 1, 3}),
MapEntry("Bulblin Camp Beta Room", "F_SP118", {2}, "F_SP118_2"),
MapEntry("Gerudo Desert", "F_SP124", {0}),
MapEntry("Mirror Chamber", "F_SP125", {4}),
}), RegionEntry("Snowpeak", {
MapEntry("Snowpeak Mountain", "F_SP114", {0, 1, 2}),
}), RegionEntry("Forest Temple", {
MapEntry("Forest Temple", "D_MN05", {0, 1, 2, 3, 4, 5, 7, 9, 10, 11, 12, 19, 22}),
MapEntry("Diababa Arena", "D_MN05A", {50}),
MapEntry("Ook Arena", "D_MN05B", {51}),
}), RegionEntry("Goron Mines", {
MapEntry("Goron Mines", "D_MN04", {1, 3, 4, 5, 6, 7, 9, 11, 12, 13, 14, 16, 17}),
MapEntry("Fyrus Arena", "D_MN04A", {50}),
MapEntry("Dangoro Arena", "D_MN04B", {51}),
}), RegionEntry("Lakebed Temple", {
MapEntry("Lakebed Temple", "D_MN01", {0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13}),
MapEntry("Morpheel Arena", "D_MN01A", {50}),
MapEntry("Deku Toad Arena", "D_MN01B", {51}),
}), RegionEntry("Arbiter's Grounds", {
MapEntry("Arbiter's Grounds", "D_MN10", {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}),
MapEntry("Stallord Arena", "D_MN10A", {50}),
MapEntry("Death Sword Arena", "D_MN10B", {51}),
}), RegionEntry("Snowpeak Ruins", {
MapEntry("Snowpeak Ruins", "D_MN11", {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 13}),
MapEntry("Blizzeta Arena", "D_MN11A", {50}),
MapEntry("Darkhammer Arena", "D_MN11B", {51}),
MapEntry("Darkhammer Beta Arena", "D_MN11B", {49}),
}), RegionEntry("Temple of Time", {
MapEntry("Temple of Time", "D_MN06", {0, 1, 2, 3, 4, 5, 6, 7, 8}),
MapEntry("Armogohma Arena", "D_MN06A", {50}),
MapEntry("Darknut Arena", "D_MN06B", {51}),
}), RegionEntry("City in the Sky", {
MapEntry("City in the Sky", "D_MN07", {0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16}),
MapEntry("Argorok Arena", "D_MN07A", {50}),
MapEntry("Aeralfos Arena", "D_MN07B", {51}),
}), RegionEntry("Palace of Twilight", {
MapEntry("Palace of Twilight", "D_MN08", {0, 1, 2, 4, 5, 7, 8, 9, 10, 11}),
MapEntry("Palace of Twilight Throne Room", "D_MN08A", {10}),
MapEntry("Phantom Zant Arena 1", "D_MN08B", {51}),
MapEntry("Phantom Zant Arena 2", "D_MN08C", {52}),
MapEntry("Zant Arenas", "D_MN08D", {50, 53, 54, 55, 56, 57, 60}),
}), RegionEntry("Hyrule Castle", {
MapEntry("Hyrule Castle", "D_MN09", {1, 2, 3, 4, 5, 6, 8, 9, 11, 12, 13, 14, 15}),
MapEntry("Hyrule Castle Throne Room", "D_MN09A", {50, 51}),
MapEntry("Horseback Ganondorf Arena", "D_MN09B", {0}),
MapEntry("Dark Lord Ganondorf Arena", "D_MN09C", {0}),
}), RegionEntry("Mini-Dungeons and Grottos", {
MapEntry("Ice Cavern", "D_SB00", {0}),
MapEntry("Cave Of Ordeals", "D_SB01",
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47, 48, 49}
),
MapEntry("Kakariko Gorge Cavern", "D_SB02", {0}),
MapEntry("Lake Hylia Cavern", "D_SB03", {0}),
MapEntry("Goron Stockcave", "D_SB04", {10}),
MapEntry("Grotto 1", "D_SB05"),
MapEntry("Grotto 2", "D_SB06", {1}),
MapEntry("Grotto 3", "D_SB07", {2}),
MapEntry("Grotto 4", "D_SB08", {3}),
MapEntry("Grotto 5", "D_SB09", {4}),
}), RegionEntry("Misc", {
MapEntry("Title Screen / King Bulblin 1", "F_SP102"),
MapEntry("King Bulblin 2", "F_SP123", {13}),
MapEntry("Wolf Howling Cutscene Map", "F_SP200"),
// MapEntry("Cutscene: Light Arrow Area", "R_SP300"),
MapEntry("Cutscene: Hyrule Castle Throne Room", "R_SP301"),
})
});
+138
View File
@@ -2,6 +2,9 @@
#define _SRC_DUSK_MATH_H_
#include <cmath>
#include <array>
#include <limits>
#include <bit>
#ifndef M_PI
#define M_PI 3.14159265358979323846f
@@ -16,4 +19,139 @@ inline float i_cosf(float x) { return cos(x); }
inline float i_tanf(float x) { return tan(x); }
inline float i_acosf(float x) { return acos(x); }
// frsqrte matching courtesy of Geotale, with reference to https://achurch.org/cpu-tests/ppc750cl.s
struct BaseAndDec32 {
uint32_t base;
int32_t dec;
};
struct BaseAndDec64 {
uint64_t base;
int64_t dec;
};
union c32 {
constexpr c32(const float p) {
f = p;
}
constexpr c32(const uint32_t p) {
u = p;
}
uint32_t u;
float f;
};
union c64 {
constexpr c64(const double p) {
f = p;
}
constexpr c64(const uint64_t p) {
u = p;
}
uint64_t u;
double f;
};
static constexpr uint64_t EXPONENT_SHIFT_F64 = 52;
static constexpr uint64_t MANTISSA_MASK_F64 = 0x000fffffffffffffULL;
static constexpr uint64_t EXPONENT_MASK_F64 = 0x7ff0000000000000ULL;
static constexpr uint64_t SIGN_MASK_F64 = 0x8000000000000000ULL;
static constexpr std::array<BaseAndDec64, 32> RSQRTE_TABLE = {{
{0x69fa000000000ULL, -0x15a0000000LL},
{0x5f2e000000000ULL, -0x13cc000000LL},
{0x554a000000000ULL, -0x1234000000LL},
{0x4c30000000000ULL, -0x10d4000000LL},
{0x43c8000000000ULL, -0x0f9c000000LL},
{0x3bfc000000000ULL, -0x0e88000000LL},
{0x34b8000000000ULL, -0x0d94000000LL},
{0x2df0000000000ULL, -0x0cb8000000LL},
{0x2794000000000ULL, -0x0bf0000000LL},
{0x219c000000000ULL, -0x0b40000000LL},
{0x1bfc000000000ULL, -0x0aa0000000LL},
{0x16ae000000000ULL, -0x0a0c000000LL},
{0x11a8000000000ULL, -0x0984000000LL},
{0x0ce6000000000ULL, -0x090c000000LL},
{0x0862000000000ULL, -0x0898000000LL},
{0x0416000000000ULL, -0x082c000000LL},
{0xffe8000000000ULL, -0x1e90000000LL},
{0xf0a4000000000ULL, -0x1c00000000LL},
{0xe2a8000000000ULL, -0x19c0000000LL},
{0xd5c8000000000ULL, -0x17c8000000LL},
{0xc9e4000000000ULL, -0x1610000000LL},
{0xbedc000000000ULL, -0x1490000000LL},
{0xb498000000000ULL, -0x1330000000LL},
{0xab00000000000ULL, -0x11f8000000LL},
{0xa204000000000ULL, -0x10e8000000LL},
{0x9994000000000ULL, -0x0fe8000000LL},
{0x91a0000000000ULL, -0x0f08000000LL},
{0x8a1c000000000ULL, -0x0e38000000LL},
{0x8304000000000ULL, -0x0d78000000LL},
{0x7c48000000000ULL, -0x0cc8000000LL},
{0x75e4000000000ULL, -0x0c28000000LL},
{0x6fd0000000000ULL, -0x0b98000000LL},
}};
[[nodiscard]] static inline double frsqrte(const double val) {
c64 bits(val);
uint64_t mantissa = bits.u & MANTISSA_MASK_F64;
int64_t exponent = bits.u & EXPONENT_MASK_F64;
bool sign = (bits.u & SIGN_MASK_F64) != 0;
// Handle 0 case
if (mantissa == 0 && exponent == 0) {
return std::copysign(std::numeric_limits<double>::infinity(), bits.f);
}
// Handle NaN-like
if (exponent == EXPONENT_MASK_F64) {
if (mantissa == 0) {
return sign ? std::numeric_limits<double>::quiet_NaN() : 0.0;
}
return val;
}
// Handle negative inputs
if (sign) {
return std::numeric_limits<double>::quiet_NaN();
}
if (exponent == 0) {
// Shift so one bit goes to where the exponent would be,
// then clear that bit to mimic a not-subnormal number!
// Aka, if there are 12 leading zeroes, shift left once
uint32_t shift = std::countl_zero(mantissa) - static_cast<uint32_t>(63 - EXPONENT_SHIFT_F64);
mantissa <<= shift;
mantissa &= MANTISSA_MASK_F64;
// The shift is subtracted by 1 because denormals by default
// are offset by 1 (exponent 0 doesn't have implied 1 bit)
exponent -= static_cast<int64_t>(shift - 1) << EXPONENT_SHIFT_F64;
}
// In reality this doesn't get the full exponent -- Only the least significant bit
// Only that's needed because square roots of higher exponent bits simply multiply the
// result by 2!!
uint32_t key = static_cast<uint32_t>((static_cast<uint64_t>(exponent) | mantissa) >> 37);
uint64_t new_exp =
(static_cast<uint64_t>((0xbfcLL << EXPONENT_SHIFT_F64) - exponent) >> 1) & EXPONENT_MASK_F64;
// Remove the bits relating to anything higher than the LSB of the exponent
const auto &entry = RSQRTE_TABLE[0x1f & (key >> 11)];
// The result is given by an estimate then an adjustment based on the original
// key that was computed
uint64_t new_mantissa = static_cast<uint64_t>(entry.base + entry.dec * static_cast<int64_t>(key & 0x7ff));
return c64(new_exp | new_mantissa).f;
}
#endif // _SRC_DUSK_MATH_H_
+103
View File
@@ -0,0 +1,103 @@
#ifndef DUSK_TIME_H
#define DUSK_TIME_H
#include <chrono>
#include <numeric>
#include <array>
#ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <Windows.h>
#include <shellapi.h>
#endif
#include "dusk/logging.h"
constexpr auto DUSK_FRAME_PERIOD = std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::duration<double>(1001.0 / 30000.0));
class Limiter {
using delta_clock = std::chrono::high_resolution_clock;
using duration_t = std::chrono::nanoseconds;
public:
void Reset() { m_oldTime = delta_clock::now(); }
void Sleep(duration_t targetFrameTime) {
if (targetFrameTime.count() == 0) {
return;
}
auto start = delta_clock::now();
duration_t adjustedSleepTime = SleepTime(targetFrameTime);
if (adjustedSleepTime.count() > 0) {
NanoSleep(adjustedSleepTime);
duration_t overslept = TimeSince(start) - adjustedSleepTime;
if (overslept < duration_t{targetFrameTime}) {
m_overheadTimes[m_overheadTimeIdx] = overslept;
m_overheadTimeIdx = (m_overheadTimeIdx + 1) % m_overheadTimes.size();
}
}
Reset();
}
duration_t SleepTime(duration_t targetFrameTime) {
const auto sleepTime = duration_t{targetFrameTime} - TimeSince(m_oldTime);
m_overhead = std::accumulate(m_overheadTimes.begin(), m_overheadTimes.end(), duration_t{}) / m_overheadTimes.size();
if (sleepTime > m_overhead) {
return sleepTime - m_overhead;
}
return duration_t{0};
}
private:
delta_clock::time_point m_oldTime;
std::array<duration_t, 4> m_overheadTimes{};
size_t m_overheadTimeIdx = 0;
duration_t m_overhead = duration_t{0};
duration_t TimeSince(delta_clock::time_point start) {
return std::chrono::duration_cast<duration_t>(delta_clock::now() - start);
}
#if _WIN32
void NanoSleep(const duration_t duration) {
static bool initialized = false;
static double countPerNs;
static size_t numSleeps = 0;
// QueryPerformanceFrequency's result is constant, but calling it occasionally
// appears to stabilize QueryPerformanceCounter. Without it, the game drifts
// from 60hz to 144hz. (Cursed, but I suspect it's NVIDIA/G-SYNC related)
if (!initialized || numSleeps++ % 1000 == 0) {
LARGE_INTEGER freq;
if (QueryPerformanceFrequency(&freq) == 0) {
DuskLog.warn("QueryPerformanceFrequency failed: {}", GetLastError());
return;
}
countPerNs = static_cast<double>(freq.QuadPart) / 1e9;
initialized = true;
numSleeps = 0;
}
LARGE_INTEGER start, current;
QueryPerformanceCounter(&start);
LONGLONG ticksToWait = static_cast<LONGLONG>(duration.count() * countPerNs);
if (DWORD ms = std::chrono::duration_cast<std::chrono::milliseconds>(duration).count(); ms > 1) {
::Sleep(ms - 1);
}
do {
QueryPerformanceCounter(&current);
_mm_pause(); // Yield CPU
} while (current.QuadPart - start.QuadPart < ticksToWait);
}
#else
void NanoSleep(const duration_t duration) { std::this_thread::sleep_for(duration); }
#endif
};
#endif
+1
View File
@@ -46,6 +46,7 @@ public:
static u32 getHoldZ(u32 pad) { return getHold(pad) & PAD_TRIGGER_Z; }
static u32 getHoldY(u32 pad) { return getHold(pad) & PAD_BUTTON_Y; }
static u32 getHoldX(u32 pad) { return getHold(pad) & PAD_BUTTON_X; }
static u32 getHoldStart(u32 pad) { return getHold(pad) & PAD_BUTTON_START; }
static f32 getStickX(u32 pad) { return getCpadInfo(pad).mMainStickPosX; }
static f32 getStickY(u32 pad) { return getCpadInfo(pad).mMainStickPosY; }
static f32 getStickX3D(u32 pad) { return getCpadInfo(pad).mMainStickPosX; }
+1 -1
View File
@@ -582,7 +582,7 @@ public:
f32* getSize(int i_idx) { return mpLines[i_idx].field_0x4; }
private:
/* 0x08 */ GXTexObj mTextureObject;
/* 0x08 */ TGXTexObj mTextureObject;
/* 0x28 */ GXColor mColor;
/* 0x2C */ dKy_tevstr_c* mpTevStr;
/* 0x30 */ u16 mNumLines;
+5 -5
View File
@@ -237,8 +237,8 @@ public:
static GXColor& getFadeColor() { return mFadeColor; }
static GXColor& getBackColor() { return mBackColor; }
static void endRender() { JFWDisplay::getManager()->endRender(); }
static GXTexObj* getZbufferTexObj() { return &mZbufferTexObj; }
static GXTexObj* getFrameBufferTexObj() { return &mFrameBufferTexObj; }
static TGXTexObj* getZbufferTexObj() { return &mZbufferTexObj; }
static TGXTexObj* getFrameBufferTexObj() { return &mFrameBufferTexObj; }
static void setFrameRate(u16 i_rate) { JFWDisplay::getManager()->setFrameRate(i_rate); }
static int getFrameBufferSize() {
@@ -285,8 +285,8 @@ public:
static void setWindowSize(AuroraWindowSize const& size);
#endif
static GXTexObj mFrameBufferTexObj;
static GXTexObj mZbufferTexObj;
static TGXTexObj mFrameBufferTexObj;
static TGXTexObj mZbufferTexObj;
static bloom_c m_bloom;
static Mtx mBlureMtx;
static GXColor mBackColor;
@@ -331,7 +331,7 @@ public:
static u8 mWideZoom;
static ResTIMG* m_fullFrameBufferTimg;
static void* m_fullFrameBufferTex;
static GXTexObj m_fullFrameBufferTexObj;
static TGXTexObj m_fullFrameBufferTexObj;
static f32 m_aspect;
static f32 m_scale;
+3 -1
View File
@@ -4,6 +4,8 @@
#include "JSystem/J3DU/J3DUClipper.h"
#include <dolphin/gx/GXStruct.h>
#include "dusk/gx_helper.h"
typedef struct Vec Vec;
struct ResTIMG;
@@ -37,7 +39,7 @@ struct mDoLib_clipper {
};
void mDoLib_project(Vec* src, Vec* dst);
u32 mDoLib_setResTimgObj(ResTIMG const* res, GXTexObj* o_texObj, u32 tlut_name,
u32 mDoLib_setResTimgObj(ResTIMG const* res, TGXTexObj* o_texObj, u32 tlut_name,
GXTlutObj* o_tlutObj);
void mDoLib_pos2camera(Vec* src, Vec* dst);
@@ -90,7 +90,6 @@ struct J3DTexMtxInfo {
/* 0x01 */ u8 mInfo;
/* 0x02 */ u8 field_0x2;
/* 0x03 */ u8 field_0x3;
// NOTE: big endian when loaded from file!
/* 0x04 */ Vec mCenter;
/* 0x10 */ J3DTextureSRTInfo mSRT;
/* 0x24 */ Mtx44 mEffectMtx;
@@ -7,9 +7,11 @@
#include "global.h"
#include <stdint.h>
#include "dusk/gx_helper.h"
/**
* @ingroup jsystem-j3d
*
*
*/
class J3DTexture {
private:
@@ -19,7 +21,7 @@ private:
#if TARGET_PC
GXTlutObj* mpTlutObj;
GXTexObj* mpTexObj;
TGXTexObj* mpTexObj;
u8** mpImgDataPtr;
u8** mpTlutDataPtr;
#endif
@@ -28,7 +30,7 @@ public:
J3DTexture(u16 num, ResTIMG* res) : mNum(num), unk_0x2(0), mpRes(res) {
J3D_ASSERT_NULLPTR(52, res != NULL || num == 0);
#if TARGET_PC
mpTexObj = new GXTexObj[num];
mpTexObj = new TGXTexObj[num];
mpTlutObj = new GXTlutObj[num];
mpImgDataPtr = new u8*[num];
mpTlutDataPtr = new u8*[num];
@@ -48,8 +50,6 @@ public:
void addResTIMG(u16, ResTIMG const*);
virtual ~J3DTexture(){
#if TARGET_PC
for (int i = 0; i < mNum; i++)
GXDestroyTexObj(&mpTexObj[i]);
delete[] mpTexObj;
delete[] mpTlutObj;
delete[] mpImgDataPtr;
+10 -1
View File
@@ -3,6 +3,7 @@
#include "JSystem/JUtility/JUTAssert.h"
#include "JSystem/JGadget/search.h"
#include "dusk/endian.h"
namespace JGadget {
namespace binary {
@@ -60,7 +61,15 @@ struct TParse_header_block {
template <typename T>
struct TParseValue_raw_ {
typedef T ParseType;
static T parse(const void* data) { return (T)*(T*)data; }
static T parse(const void* data) {
T val = *(T*)data;
#ifdef TARGET_PC
if constexpr (sizeof(T) > 1) {
be_swap(val);
}
#endif
return val;
}
};
template <typename T>
@@ -289,17 +289,17 @@ inline void jkrDelete(void* ptr) {
}
template<typename... Args>
bool constexpr newArgsHasCustomAlignment(Args&&...) {
bool constexpr newArgsHasCustomAlignment() {
return false;
}
template<>
constexpr bool newArgsHasCustomAlignment(int&&) {
template<int>
constexpr bool newArgsHasCustomAlignment() {
return true;
}
template<>
constexpr bool newArgsHasCustomAlignment(JKRHeap*&&, int&&) {
template<JKRHeap*, int>
constexpr bool newArgsHasCustomAlignment() {
return true;
}
@@ -308,7 +308,7 @@ T* jkrNewArray(size_t count, std::in_place_type_t<T>, Args&&... args) {
size_t allocSize = count * sizeof(T);
if constexpr (!std::is_trivially_destructible<T>()) {
static_assert(
!newArgsHasCustomAlignment(args...),
!newArgsHasCustomAlignment<Args...>(),
"jkrNewArray cannot currently handle non-trivially-destructible array allocations with custom alignment");
allocSize += sizeof(size_t);
+7 -1
View File
@@ -4,6 +4,8 @@
#include <mtx.h>
#include <cmath>
#include "dusk/math.h"
typedef f32 Mtx33[3][3];
typedef f32 Mtx23[2][3];
typedef f32 (*Mtx3P)[3];
@@ -70,7 +72,11 @@ inline f32 JMAFastSqrt(__REGISTER const f32 input) {
return input;
}
#else
return sqrt(input);
if (input > 0.0f) {
return frsqrte(input) * input;
} else {
return input;
}
#endif
}
@@ -42,7 +42,7 @@ struct TResource {
char* getMessageText_messageEntry(const void* pEntry) const {
JUT_ASSERT(141, pEntry!=NULL);
return pMessageText_ + *(int*)pEntry;
return pMessageText_ + *(BE(s32)*)pEntry;
}
const char* getMessageText_messageIndex(u16 uMessageIndex) const {
@@ -252,7 +252,7 @@ public:
/* 0xB0 */ JGeometry::TVec2<f32> mGlobalPScl;
/* 0xB8 */ GXColor mGlobalPrmClr;
/* 0xBC */ GXColor mGlobalEnvClr;
/* 0xC0 */ s32 mpUserWork;
/* 0xC0 */ uintptr_t mpUserWork;
/* 0xC4 */ JPARandom mRndm;
/* 0xC8 */ JPAList<JPABaseParticle> mAlivePtclBase;
/* 0xD4 */ JPAList<JPABaseParticle> mAlivePtclChld;
@@ -29,7 +29,7 @@ public:
};
struct TCachePage : TGlyphCacheInfo {
/* 0x20 */ GXTexObj mTexObj;
/* 0x20 */ TGXTexObj mTexObj;
/* 0x40 */ u8 mImage[];
}; // Size: 0x40
@@ -61,7 +61,7 @@ public:
void setPagingType(EPagingType type) { mPagingType = type; }
static u32 calcCacheSize(u32 param_0, int param_1) { return (ALIGN_NEXT(param_0, 0x20) + 0x40) * param_1; }
GXTexObj* getTexObj(void* buffer) const { return &((TCachePage*)buffer)->mTexObj; }
TGXTexObj* getTexObj(void* buffer) const { return &((TCachePage*)buffer)->mTexObj; }
void delete_and_initialize() { deleteMemBlocks_CacheFont(); initialize_state(); }
u32 getCachePage() const {
@@ -2,6 +2,7 @@
#define JUTRESFONT_H
#include "JSystem/JUtility/JUTFont.h"
#include "dusk/gx_helper.h"
class JKRHeap;
@@ -63,7 +64,7 @@ public:
// some types uncertain, may need to be fixed
/* 0x1C */ int mWidth;
/* 0x20 */ int mHeight;
/* 0x24 */ GXTexObj mTexObj;
/* 0x24 */ TGXTexObj mTexObj;
/* 0x44 */ int mTexPageIdx;
/* 0x48 */ const ResFONT* mResFont;
/* 0x4C */ ResFONT::INF1* mInf1Ptr;
@@ -4,6 +4,7 @@
#include <gx.h>
#include <stdint.h>
#include "dusk/endian.h"
#include "dusk/gx_helper.h"
class JUTPalette;
@@ -95,7 +96,7 @@ public:
}
private:
/* 0x00 */ GXTexObj mTexObj;
/* 0x00 */ TGXTexObj mTexObj;
/* 0x20 */ const ResTIMG* mTexInfo;
/* 0x24 */ void* mTexData;
/* 0x28 */ JUTPalette* mEmbPalette;
+2 -2
View File
@@ -28,11 +28,11 @@ J2DWindowEx::J2DWindowEx(J2DPane* param_0, JSURandomInputStream* param_1, u32 pa
mAnmVisibilityFull = NULL;
mAnmVtxColor = NULL;
s32 position = param_1->getPosition();
int uStack_88[2];
BE(int) uStack_88[2];
param_1->read(uStack_88, 8);
mKind = uStack_88[0];
s32 iVar2 = param_1->getPosition();
int auStack_90[2];
BE(int) auStack_90[2];
param_1->peek(auStack_90, 8);
makePaneExStream(param_0, param_1);
param_1->seek(iVar2 + auStack_90[1], JSUStreamSeekFrom_SET);
+4 -8
View File
@@ -350,11 +350,8 @@ void J3DGDSetTexImgAttr(GXTexMapID id, u16 width, u16 height, GXTexFmt format) {
}
void J3DGDSetTexImgPtr(GXTexMapID id, void* image_ptr) {
#if TARGET_PC
STUB_LOG();
#else
STUB_RET();
J3DGDWriteBPCmd(BP_IMAGE_PTR(OSCachedToPhysical(image_ptr) >> 5, J3DGDTexImage3Ids[id]));
#endif
}
void J3DGDSetTexImgPtrRaw(GXTexMapID id, u32 image_ptr_raw) {
@@ -372,10 +369,9 @@ void J3DGDLoadTlut(void* tlut_ptr, u32 tmem_addr, GXTlutSize size) {
J3DGDWriteBPCmd(0xFEFFFF00);
J3DGDWriteBPCmd(0xF000000);
#if TARGET_PC
STUB_LOG();
return;
#endif
STUB_RET();
J3DGDWriteBPCmd(BP_LOAD_TLUT0(OSCachedToPhysical(tlut_ptr) >> 5, 0x64));
J3DGDWriteBPCmd(BP_LOAD_TLUT1((tmem_addr - 0x80000) >> 9, size, 0x65));
J3DGDWriteBPCmd(0xFEFFFF00);
+4 -3
View File
@@ -1,9 +1,10 @@
#include "JSystem/JSystem.h" // IWYU pragma: keep
#include "JSystem/J3DGraphBase/J3DFifo.h"
#include "JSystem/J3DGraphBase/J3DSys.h"
#include "JSystem/J3DGraphBase/J3DTevs.h"
#include "JSystem/J3DGraphBase/J3DTexture.h"
#include "JSystem/J3DGraphBase/J3DFifo.h"
#include "dusk/gx_helper.h"
#include "global.h"
J3DSys j3dSys;
@@ -265,14 +266,14 @@ void J3DSys::reinitTransform() {
void J3DSys::reinitTexture() {
#if TARGET_PC
static GXTexObj texObj;
static TGXTexObj texObj;
static bool initialized = false;
if (!initialized) {
GXInitTexObj(&texObj, NullTexData, 4, 4, GX_TF_IA8, GX_CLAMP, GX_CLAMP, GX_FALSE);
initialized = true;
}
#else
GXTexObj texObj;
TGXTexObj texObj;
GXInitTexObj(&texObj, NullTexData, 4, 4, GX_TF_IA8, GX_CLAMP, GX_CLAMP, GX_FALSE);
#endif
GXLoadTexObj(&texObj, GX_TEXMAP0);
+3 -3
View File
@@ -22,7 +22,7 @@ void J3DTexture::loadGX(u16 idx, GXTexMapID texMapID) const {
}
GXLoadTexObj(&mpTexObj[idx], texMapID);
#else
GXTexObj texObj;
TGXTexObj texObj;
GXTlutObj tlutObj;
if (!timg->indexTexture) {
@@ -54,7 +54,7 @@ void J3DTexture::loadGXTexObj(u16 idx) {
ResTIMG* timg = getResTIMG(idx);
GXTlutObj& tlutObj = mpTlutObj[idx];
GXTexObj& texObj = mpTexObj[idx];
TGXTexObj& texObj = mpTexObj[idx];
if (!timg->indexTexture) {
GXInitTexObj(&texObj, mpImgDataPtr[idx], timg->width, timg->height,
@@ -88,7 +88,7 @@ void J3DTexture::entryNum(u16 num) {
delete[] mpTlutObj;
delete[] mpImgDataPtr;
delete[] mpTlutDataPtr;
mpTexObj = new GXTexObj[num]();
mpTexObj = new TGXTexObj[num]();
mpTlutObj = new GXTlutObj[num]();
mpImgDataPtr = new u8*[num]();
mpTlutDataPtr = new u8*[num]();
@@ -22,7 +22,7 @@ void J3DGQRSetup7(u32 r0, u32 r1, u32 r2, u32 r3) {
}
// this uses a non-standard sqrtf, not sure why or how its supposed to be setup
#if !PLATFORM_SHIELD
#if !PLATFORM_SHIELD && !TARGET_PC
inline f32 J3D_sqrtf(__REGISTER f32 x) {
__REGISTER f32 recip;
@@ -545,6 +545,8 @@ J3DTexMtx* J3DMaterialFactory::newTexMtx(int i_idx, int i_no) const {
be_swap(tex_mtx_info.mSRT.mRotation);
be_swap(tex_mtx_info.mSRT.mTranslationX);
be_swap(tex_mtx_info.mSRT.mTranslationY);
for (int i = 0; i < 16; i++)
be_swap(tex_mtx_info.mEffectMtx[i / 4][i % 4]);
tex_mtx = JKR_NEW J3DTexMtx(tex_mtx_info);
#else
tex_mtx = JKR_NEW J3DTexMtx(mpTexMtxInfo[mtl_init_data->mTexMtxIdx[i_no]]);
+1 -1
View File
@@ -108,7 +108,7 @@ bool JAISeq::prepare_getSeqData_() {
switch (seqDataMgr->getSeqData(getID(), &inner_.mSeqData)) {
case 0:
OS_REPORT("Failed In Loading Sequence Data:SEQ(0x%08x)\n", getID());
OS_REPORT("Failed In Loading Sequence Data:SEQ(0x%08x)\n", (u32)getID());
status_.state.unk = 2;
break;
case 1:
+7 -10
View File
@@ -2,7 +2,9 @@
#include <dolphin/gx.h>
#include <dolphin/vi.h>
#include <gx.h>
#include <stdint.h>
#include <vi.h>
#include "JSystem/J2DGraph/J2DOrthoGraph.h"
#include "JSystem/JFramework/JFWDisplay.h"
#include "JSystem/JKernel/JKRHeap.h"
@@ -10,13 +12,10 @@
#include "JSystem/JUtility/JUTConsole.h"
#include "JSystem/JUtility/JUTDbPrint.h"
#include "JSystem/JUtility/JUTProcBar.h"
#include <gx.h>
#include <vi.h>
#include "global.h"
#include "aurora/aurora.h"
#include "global.h"
#include "JSystem/JKernel/JKRHeap.h"
#include "dusk/gx_helper.h"
#include "dusk/logging.h"
#include "global.h"
void JFWDisplay::ctor_subroutine(bool enableAlpha) {
mEnableAlpha = enableAlpha;
@@ -419,7 +418,7 @@ static u8 clear_z_TX[64] ATTRIBUTE_ALIGN(32) = {
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
};
static GXTexObj clear_z_tobj;
static TGXTexObj clear_z_tobj;
void JFWDisplay::clearEfb_init() {
GXInitTexObj(&clear_z_tobj, &clear_z_TX, 4, 4, GX_TF_Z24X8, GX_REPEAT, GX_REPEAT, GX_FALSE);
@@ -439,10 +438,8 @@ void JFWDisplay::clearEfb(GXColor color) {
}
void JFWDisplay::clearEfb(int param_0, int param_1, int param_2, int param_3, GXColor color) {
#if TARGET_PC
STUB_LOG();
return;
#endif
STUB_RET();
u16 width;
u16 height;
Mtx44 mtx;
+10 -3
View File
@@ -14,6 +14,9 @@ u32 JKRArchive::sCurrentDirID;
JKRArchive::JKRArchive() {
mIsMounted = false;
mMountDirection = MOUNT_DIRECTION_HEAD;
#if TARGET_PC
mFileData = nullptr;
#endif
}
JKRArchive::JKRArchive(s32 entryNumber, JKRArchive::EMountMode mountMode) {
@@ -21,6 +24,9 @@ JKRArchive::JKRArchive(s32 entryNumber, JKRArchive::EMountMode mountMode) {
mMountMode = mountMode;
mMountCount = 1;
field_0x58 = 1;
#if TARGET_PC
mFileData = nullptr;
#endif
mHeap = JKRHeap::findFromRoot(this);
if (mHeap == NULL) {
@@ -37,7 +43,7 @@ JKRArchive::JKRArchive(s32 entryNumber, JKRArchive::EMountMode mountMode) {
JKRArchive::~JKRArchive() {
#if TARGET_PC
if (mFileData != nullptr) {
mHeap->free(mFileData);
JKRHeap::getSystemHeap()->free(mFileData);
mFileData = nullptr;
}
#endif
@@ -251,11 +257,12 @@ void JKRArchive::initFileDataPointers() {
assert(mFiles);
if (mFileData != nullptr) {
mHeap->free(mFileData);
JKRHeap::getSystemHeap()->free(mFileData);
mFileData = nullptr;
}
mFileData = static_cast<void**>(
mHeap->alloc(mArcInfoBlock->num_file_entries * sizeof(void*), alignof(void*)));
JKRHeap::getSystemHeap()->alloc(mArcInfoBlock->num_file_entries * sizeof(void*), alignof(void*)));
memset(mFileData, 0, mArcInfoBlock->num_file_entries * sizeof(void*));
-2
View File
@@ -103,8 +103,6 @@ void JMAVECScaleAdd(__REGISTER const Vec* vec1, __REGISTER const Vec* vec2, __RE
dst->y = vec1->y * scale + vec2->y;
dst->z = vec1->z * scale + vec2->z;
#endif // clang-format on
OSPanic(__FILE__, __LINE__, "UNIMPLEMENTED");
}
void JMAMTXApplyScale(__REGISTER const Mtx src, __REGISTER Mtx dst, __REGISTER f32 xScale,
+4 -4
View File
@@ -65,12 +65,12 @@ u16 JMessage::TResource::toMessageIndex_messageID(u32 uMsgID, u32 upperHalf, boo
int nMsgNumber = oParse_TBlock_messageID_.get_number();
const u32* pContent = (u32*)oParse_TBlock_messageID_.getContent();
const BE(u32)* pContent = (const BE(u32)*)oParse_TBlock_messageID_.getContent();
JUT_ASSERT(131, pContent!=NULL);
const u32* pFirst = pContent;
const u32* pLast = pFirst + nMsgNumber;
const u32* pEntry;
const BE(u32)* pFirst = pContent;
const BE(u32)* pLast = pFirst + nMsgNumber;
const BE(u32)* pEntry;
if (oParse_TBlock_messageID_.get_isOrdered()) {
pEntry = std::lower_bound(pFirst, pLast, uMsgValue);
@@ -66,8 +66,20 @@ static void JPAVolumeSphere(JPAEmitterWorkData* work) {
s16 phi, r28;
if (work->mpEmtr->checkFlag(JPADynFlag_FixedInterval)) {
phi = u16(work->mVolumeX * 0x8000 / (work->mDivNumber - 1) + 0x4000);
#if TARGET_PC
// Fix div by 0 error here
// TODO: maybe review a better way of handling div by 0 UB
r28 = 0x8000;
if (work->mVolumeAngleNum > 1) {
u16 r26 = u16(work->mVolumeAngleNum * 0x10000 / (work->mVolumeAngleMax - 1));
r28 += f32(r26) * work->mVolumeSweep + 0x8000;
}
#else
u16 r26 = u16(work->mVolumeAngleNum * 0x10000 / (work->mVolumeAngleMax - 1));
r28 = f32(r26) * work->mVolumeSweep + 0x8000;
#endif
work->mVolumeAngleNum++;
if (work->mVolumeAngleNum == work->mVolumeAngleMax) {
work->mVolumeAngleNum = 0;
+8 -2
View File
@@ -1,6 +1,10 @@
#include "JSystem/JSystem.h" // IWYU pragma: keep
#include "JSystem/JParticle/JPAResource.h"
#include <cstring>
#include <gx.h>
#include "JSystem/JKernel/JKRHeap.h"
#include "JSystem/JParticle/JPABaseShape.h"
#include "JSystem/JParticle/JPAChildShape.h"
@@ -11,7 +15,6 @@
#include "JSystem/JParticle/JPAKeyBlock.h"
#include "JSystem/JParticle/JPAParticle.h"
#include "JSystem/JParticle/JPAResourceManager.h"
#include <gx.h>
#include "global.h"
JPAResource::JPAResource() {
@@ -937,7 +940,10 @@ void JPAResource::setPTev() {
if (pEts->isUseIndirect()) {
GXSetIndTexOrder(GX_INDTEXSTAGE0, tex_coord, GX_TEXMAP2);
GXSetIndTexCoordScale(GX_INDTEXSTAGE0, GX_ITS_1, GX_ITS_1);
GXSetIndTexMtx(GX_ITM_0, (f32(*)[3])pEts->getIndTexMtx(), pEts->getExpScale());
f32 indMtx[6];
std::memcpy(indMtx, pEts->getIndTexMtx(), sizeof(indMtx));
be_swap(indMtx);
GXSetIndTexMtx(GX_ITM_0, indMtx, pEts->getExpScale());
GXSetTevIndirect(GX_TEVSTAGE0, GX_INDTEXSTAGE0, GX_ITF_8, GX_ITB_STU, GX_ITM_0,
GX_ITW_OFF, GX_ITW_OFF, 0, 0, GX_ITBA_OFF);
ind_stages++;
+3 -3
View File
@@ -261,17 +261,17 @@ void TObject::process_paragraph_reserved_(u32 arg1, const void* pContent, u32 uS
case 0x1:
ASSERT(pContent != NULL);
ASSERT(uSize == 4);
setFlag_operation_(*(u32*)pContent);
setFlag_operation_(*(BE(u32)*)pContent);
break;
case 0x2:
ASSERT(pContent != NULL);
ASSERT(uSize == 4);
setWait(*(u32*)pContent);
setWait(*(BE(u32)*)pContent);
break;
case 0x3: {
ASSERT(pContent != NULL);
ASSERT(uSize == 4);
const void* seq = getSequence_offset(*(s32*)pContent);
const void* seq = getSequence_offset(*(BE(s32)*)pContent);
setSequence_next(seq);
break;
}
@@ -153,7 +153,7 @@ void JStudio_JAudio2::TAdaptor_sound::adaptor_do_SOUND(JStudio::data::TEOperatio
case JStudio::data::UNK_0x19:
JUT_ASSERT(283, pContent!=NULL);
JUT_ASSERT(284, uSize==4);
field_0x124 = *(u32*)pContent;
field_0x124 = *(BE(u32)*)pContent;
prepareSound_();
break;
}
@@ -175,7 +175,7 @@ void JStudio_JAudio2::TAdaptor_sound::adaptor_do_BEGIN_FADE_IN(
case JStudio::data::UNK_0x2:
JUT_ASSERT(323, pContent!=NULL);
JUT_ASSERT(324, uSize==4);
beginSound_fadeIn_(*(f32*)pContent);
beginSound_fadeIn_(*(BE(f32)*)pContent);
break;
}
}
@@ -196,7 +196,7 @@ void JStudio_JAudio2::TAdaptor_sound::adaptor_do_END_FADE_OUT(
case JStudio::data::UNK_0x2:
JUT_ASSERT(364, pContent!=NULL);
JUT_ASSERT(365, uSize==4);
endSound_fadeOut_(*(f32*)pContent);
endSound_fadeOut_(*(BE(f32)*)pContent);
break;
}
}
@@ -235,7 +235,7 @@ void JStudio_JAudio2::TAdaptor_sound::adaptor_do_PARENT_NODE(JStudio::data::TEOp
case JStudio::data::UNK_0x19:
JUT_ASSERT(447, uSize==4);
JUT_ASSERT(448, pContent!=NULL);
field_0x140 = *(u32*)pContent;
field_0x140 = *(BE(u32)*)pContent;
break;
}
}
@@ -245,7 +245,7 @@ void JStudio_JAudio2::TAdaptor_sound::adaptor_do_PARENT_ENABLE(
if (param_1 == JStudio::data::UNK_0x2) {
JUT_ASSERT(468, uSize == 4);
JUT_ASSERT(469, pContent != NULL);
field_0x144 = *(u32*)pContent ? 1 : 0;
field_0x144 = *(BE(u32)*)pContent ? 1 : 0;
}
}
@@ -254,7 +254,7 @@ void JStudio_JAudio2::TAdaptor_sound::adaptor_do_REPEAT(JStudio::data::TEOperati
if (param_1 == JStudio::data::UNK_0x2) {
JUT_ASSERT(490, uSize == 4);
JUT_ASSERT(491, pContent != NULL);
field_0x11e = *(u32*)pContent ? 1 : 0;
field_0x11e = *(BE(u32)*)pContent ? 1 : 0;
}
}
@@ -263,7 +263,7 @@ void JStudio_JAudio2::TAdaptor_sound::adaptor_do_CONTINUOUS(JStudio::data::TEOpe
if (param_1 == JStudio::data::UNK_0x2) {
JUT_ASSERT(512, uSize == 4);
JUT_ASSERT(513, pContent != NULL);
field_0x11d = *(u32*)pContent ? 1 : 0;
field_0x11d = *(BE(u32)*)pContent ? 1 : 0;
}
}
@@ -272,7 +272,7 @@ void JStudio_JAudio2::TAdaptor_sound::adaptor_do_LOCATED(JStudio::data::TEOperat
if (param_1 == JStudio::data::UNK_0x2) {
JUT_ASSERT(534, pContent != NULL);
JUT_ASSERT(535, uSize == 4);
u32 val = *(u32*)pContent;
u32 val = *(BE(u32)*)pContent;
field_0x12c = NULL;
if (val != 0) {
field_0x12c = &field_0x130;
@@ -285,7 +285,7 @@ void JStudio_JAudio2::TAdaptor_sound::adaptor_do_ON_EXIT_NOT_END(
if (param_1 == JStudio::data::UNK_0x2) {
JUT_ASSERT(512, uSize == 4);
JUT_ASSERT(513, pContent != NULL);
field_0x11f = *(u32*)pContent ? 1 : 0;
field_0x11f = *(BE(u32)*)pContent ? 1 : 0;
}
}
@@ -104,7 +104,7 @@ void JStudio_JParticle::TAdaptor_particle::adaptor_do_PARTICLE(
if (param_1 == JStudio::data::UNK_0x19) {
JUT_ASSERT(232, uSize==4);
JUT_ASSERT(233, pContent!=NULL);
field_0x1bc = *(u32*)pContent;
field_0x1bc = *(BE(u32)*)pContent;
}
}
@@ -124,7 +124,7 @@ void JStudio_JParticle::TAdaptor_particle::adaptor_do_BEGIN_FADE_IN(
case JStudio::data::UNK_0x2:
JUT_ASSERT(272, pContent!=NULL);
JUT_ASSERT(273, uSize==4);
beginParticle_fadeIn_(*(f32*)pContent);
beginParticle_fadeIn_(*(BE(f32)*)pContent);
break;
}
}
@@ -143,7 +143,7 @@ void JStudio_JParticle::TAdaptor_particle::adaptor_do_END_FADE_OUT(
case JStudio::data::UNK_0x2:
JUT_ASSERT(336, pContent!=NULL);
JUT_ASSERT(337, uSize==4);
endParticle_fadeOut_(*(f32*)pContent);
endParticle_fadeOut_(*(BE(f32)*)pContent);
break;
}
}
@@ -182,7 +182,7 @@ void JStudio_JParticle::TAdaptor_particle::adaptor_do_PARENT_NODE(
case JStudio::data::UNK_0x19:
JUT_ASSERT(397, uSize==4);
JUT_ASSERT(396, pContent!=NULL);
field_0x1d4 = *(u32*)pContent;
field_0x1d4 = *(BE(u32)*)pContent;
break;
}
}
@@ -192,7 +192,7 @@ void JStudio_JParticle::TAdaptor_particle::adaptor_do_PARENT_ENABLE(JStudio::dat
if (param_1 == JStudio::data::UNK_0x2) {
JUT_ASSERT(417, uSize==4);
JUT_ASSERT(418, pContent!=NULL);
field_0x1d8 = *(u32*)pContent ? 1 : 0;
field_0x1d8 = *(BE(u32)*)pContent ? 1 : 0;
}
}
@@ -201,7 +201,7 @@ void JStudio_JParticle::TAdaptor_particle::adaptor_do_PARENT_FUNCTION(JStudio::d
if (param_1 == JStudio::data::UNK_0x2) {
JUT_ASSERT(439, uSize==4);
JUT_ASSERT(439, pContent!=NULL);
field_0x1cc = *(u32*)pContent;
field_0x1cc = *(BE(u32)*)pContent;
}
}
@@ -210,7 +210,7 @@ void JStudio_JParticle::TAdaptor_particle::adaptor_do_REPEAT(JStudio::data::TEOp
if (param_1 == JStudio::data::UNK_0x2) {
JUT_ASSERT(460, uSize==4);
JUT_ASSERT(461, pContent!=NULL);
field_0x1b5 = *(u32*)pContent ? 1 : 0;
field_0x1b5 = *(BE(u32)*)pContent ? 1 : 0;
}
}
@@ -219,7 +219,7 @@ void JStudio_JParticle::TAdaptor_particle::adaptor_do_ON_EXIT_NOT_END(JStudio::d
if (param_1 == JStudio::data::UNK_0x2) {
JUT_ASSERT(460, uSize==4);
JUT_ASSERT(461, pContent!=NULL);
field_0x1b6 = *(u32*)pContent ? 1 : 0;
field_0x1b6 = *(BE(u32)*)pContent ? 1 : 0;
}
}
@@ -98,7 +98,7 @@ void JStudio_JStage::TAdaptor_actor::adaptor_do_ANIMATION_MODE(JStudio::data::TE
case JStudio::data::UNK_0x2:
JUT_ASSERT(153, uSize==4);
JUT_ASSERT(154, pContent!=NULL);
field_0x130 = *(u32*)pContent;
field_0x130 = *(BE(u32)*)pContent;
break;
}
}
@@ -114,7 +114,7 @@ void JStudio_JStage::TAdaptor_actor::adaptor_do_TEXTURE_ANIMATION_MODE(
case JStudio::data::UNK_0x2:
JUT_ASSERT(182, uSize==4);
JUT_ASSERT(183, pContent!=NULL);
field_0x134 = *(u32*)pContent;
field_0x134 = *(BE(u32)*)pContent;
break;
}
}
@@ -141,7 +141,7 @@ void JStudio_JStage::TAdaptor_actor::adaptor_do_PARENT_NODE(
case JStudio::data::UNK_0x19:
JUT_ASSERT(237, uSize==4);
JUT_ASSERT(238, pContent!=NULL);
field_0x140 = *(u32*)pContent;
field_0x140 = *(BE(u32)*)pContent;
break;
}
}
@@ -152,7 +152,7 @@ void JStudio_JStage::TAdaptor_actor::adaptor_do_PARENT_ENABLE(
case JStudio::data::UNK_0x2:
JUT_ASSERT(257, uSize==4);
JUT_ASSERT(258, pContent!=NULL);
bool v0 = (*(u32*)pContent != 0);
bool v0 = (*(BE(u32)*)pContent != 0);
if (field_0x144 != v0) {
field_0x144 = v0;
switch (field_0x138) {
@@ -179,7 +179,7 @@ void JStudio_JStage::TAdaptor_actor::adaptor_do_PARENT_FUNCTION(
case JStudio::data::UNK_0x2:
JUT_ASSERT(303, uSize==4);
JUT_ASSERT(304, pContent!=NULL);
field_0x138 = *(u32*)pContent;
field_0x138 = *(BE(u32)*)pContent;
break;
}
}
@@ -99,7 +99,7 @@ void JStudio_JStage::TAdaptor_camera::adaptor_do_PARENT_NODE(JStudio::data::TEOp
case JStudio::data::UNK_0x19:
JUT_ASSERT(166, uSize==4);
JUT_ASSERT(167, pContent!=NULL);
field_0x110 = *(int*)pContent;
field_0x110 = *(BE(s32)*)pContent;
break;
}
}
@@ -111,7 +111,7 @@ JStudio_JStage::TAdaptor_camera::adaptor_do_PARENT_ENABLE(JStudio::data::TEOpera
case JStudio::data::UNK_0x2:
JUT_ASSERT(185, uSize==4);
JUT_ASSERT(186, pContent!=NULL);
field_0x114 = *(u32*)pContent ? true : false;
field_0x114 = *(BE(u32)*)pContent ? true : false;
switch(field_0x108) {
case 1: {
JStage::TObject* parent = 0;
@@ -137,7 +137,7 @@ JStudio_JStage::TAdaptor_camera::adaptor_do_PARENT_FUNCTION(JStudio::data::TEOpe
case JStudio::data::UNK_0x2:
JUT_ASSERT(226, uSize==4);
JUT_ASSERT(227, pContent!=NULL);
field_0x108 = *(int*)pContent;
field_0x108 = *(BE(s32)*)pContent;
break;
}
}
@@ -164,7 +164,7 @@ void JStudio_JStage::TAdaptor_camera::adaptor_do_TARGET_PARENT_NODE(
case JStudio::data::UNK_0x19:
JUT_ASSERT(282, uSize==4);
JUT_ASSERT(283, pContent!=NULL);
field_0x11c = *(int*)pContent;
field_0x11c = *(BE(s32)*)pContent;
break;
}
}
@@ -175,7 +175,7 @@ void JStudio_JStage::TAdaptor_camera::adaptor_do_TARGET_PARENT_ENABLE(
case JStudio::data::UNK_0x2:
JUT_ASSERT(301, uSize==4);
JUT_ASSERT(302, pContent!=NULL);
field_0x120 = *(int*)pContent ? 1 : 0;
field_0x120 = *(BE(s32)*)pContent ? 1 : 0;
break;
}
}
@@ -125,7 +125,7 @@ void JStudio_JStage::TAdaptor_light::adaptor_do_FACULTY(JStudio::data::TEOperati
JUT_ASSERT(198, uSize==4);
JUT_ASSERT(199, pContent!=NULL);
JStage::TELight lightType;
switch (*(u32*)pContent) {
switch (*(BE(u32)*)pContent) {
case 0x301:
lightType = JStage::TELIGHT_1;
break;
@@ -82,7 +82,7 @@ void JStudio_JStage::TAdaptor_object_::adaptor_object_data_(void const* param_1,
if (param_2 == 0) {
uVar3 = JStage::TActor::ID_NORMAL;
} else {
uVar3 = *(int*)param_1;
uVar3 = *(BE(s32)*)param_1;
}
pJSGObject_->JSGSetData(uVar3, param_3, param_4);
}
@@ -113,7 +113,7 @@ JStudio_JStage::TAdaptor_object_::adaptor_object_ENABLE_(JStudio::data::TEOperat
case JStudio::data::UNK_0x2:
JUT_ASSERT(157, uSize==4);
JUT_ASSERT(158, pContent!=NULL);
if (*(u32*)pContent != 0) {
if (*(BE(u32)*)pContent != 0) {
pJSGObject_->JSGFEnableFlag(2);
} else {
pJSGObject_->JSGFDisableFlag(2);
@@ -431,6 +431,7 @@ void JUTCacheFont::invalidiateAllCache() {
field_0xa4 = (TGlyphCacheInfo*)mCacheBuffer;
field_0x9c = NULL;
field_0xa0 = NULL;
// TARGET_PC TODO: we're leaking all GXTexObj here
}
void JUTCacheFont::unlink(JUTCacheFont::TGlyphCacheInfo* cacheInfo) {
+3
View File
@@ -417,6 +417,9 @@ void JUTResFont::loadImage(int code, GXTexMapID id){
if (pageIdx != mTexPageIdx || i != field_0x66)
{
void* pImg = &mpGlyphBlocks[i]->data[pageIdx * mpGlyphBlocks[i]->textureSize];
#ifdef TARGET_PC
mTexObj.reset();
#endif
GXInitTexObj(&mTexObj, pImg, mpGlyphBlocks[i]->textureWidth,
mpGlyphBlocks[i]->textureHeight, (GXTexFmt)(u16)mpGlyphBlocks[i]->textureFormat,
GX_CLAMP, GX_CLAMP, 0);
+7 -2
View File
@@ -15,7 +15,6 @@ JUTTexture::~JUTTexture() {
if (getEmbPaletteDelFlag()) {
JKR_DELETE(mEmbPalette);
}
GXDestroyTexObj(&mTexObj);
}
void JUTTexture::storeTIMG(ResTIMG const* param_0, u8 param_1) {
@@ -50,7 +49,7 @@ void JUTTexture::storeTIMG(ResTIMG const* param_0, u8 param_1) {
tlut = (GXTlut)param_1;
}
u32 palOffset = mTexInfo->paletteOffset;
s32 palOffset = mTexInfo->paletteOffset;
if (mEmbPalette == NULL || !getEmbPaletteDelFlag()) {
mEmbPalette = JKR_NEW JUTPalette(tlut, (GXTlutFmt)mTexInfo->colorFormat,
@@ -148,6 +147,9 @@ void JUTTexture::initTexObj() {
u8* image = ((u8*)mTexInfo);
u32 imgOffset = mTexInfo->imageOffset;
image += (imgOffset ? imgOffset : 0x20);
#ifdef TARGET_PC
mTexObj.reset();
#endif
GXInitTexObj(&mTexObj, image, mTexInfo->width, mTexInfo->height,
(GXTexFmt)mTexInfo->format, (GXTexWrapMode)mWrapS, (GXTexWrapMode)mWrapT,
mipmapEnabled);
@@ -165,6 +167,9 @@ void JUTTexture::initTexObj(GXTlut param_0) {
(u16)mTexInfo->height,
(void*)mTexInfo);
image += (imgOffset ? imgOffset : 0x20);
#ifdef TARGET_PC
mTexObj.reset();
#endif
GXInitTexObjCI(&mTexObj, image, mTexInfo->width, mTexInfo->height,
(GXCITexFmt)mTexInfo->format, (GXTexWrapMode)mWrapS,
(GXTexWrapMode)mWrapT, mipmapEnabled, param_0);
-322
View File
@@ -1,322 +0,0 @@
#ifndef _DOLPHIN_CARD_H_
#define _DOLPHIN_CARD_H_
#include <dolphin/os.h>
#include <dolphin/dsp.h>
#include <dolphin/dvd.h>
#ifdef __cplusplus
extern "C" {
#endif
#define CARD_FILENAME_MAX 32
#define CARD_MAX_FILE 127
#define CARD_ICON_MAX 8
typedef void (*CARDCallback)(s32 chan, s32 result);
typedef struct CARDFileInfo {
s32 chan;
s32 fileNo;
s32 offset;
s32 length;
u16 iBlock;
} CARDFileInfo;
typedef struct CARDDir {
u8 gameName[4];
u8 company[2];
u8 _padding0;
u8 bannerFormat;
u8 fileName[CARD_FILENAME_MAX];
u32 time; // seconds since 01/01/2000 midnight
u32 iconAddr; // 0xffffffff if not used
u16 iconFormat;
u16 iconSpeed;
u8 permission;
u8 copyTimes;
u16 startBlock;
u16 length;
u8 _padding1[2];
u32 commentAddr; // 0xffffffff if not used
} CARDDir;
typedef struct CARDControl {
/* 0x000 */ BOOL attached;
/* 0x004 */ s32 result;
/* 0x008 */ u16 size;
/* 0x00A */ u16 pageSize;
/* 0x00C */ s32 sectorSize;
/* 0x010 */ u16 cBlock;
/* 0x012 */ u16 vendorID;
/* 0x014 */ s32 latency;
/* 0x018 */ u8 id[12];
/* 0x024 */ int mountStep;
/* 0x028 */ int formatStep;
/* 0x028 */ u32 scramble;
/* 0x02C */ DSPTaskInfo task;
/* 0x080 */ void* workArea;
/* 0x084 */ CARDDir *currentDir;
/* 0x088 */ u16* currentFat;
/* 0x08C */ OSThreadQueue threadQueue;
/* 0x094 */ u8 cmd[9];
/* 0x0A0 */ s32 cmdlen;
/* 0x0A4 */ volatile u32 mode;
/* 0x0A8 */ int retry;
/* 0x0AC */ int repeat;
/* 0x0B0 */ u32 addr;
/* 0x0B4 */ void* buffer;
/* 0x0B8 */ s32 xferred;
/* 0x0BC */ u16 freeNo;
/* 0x0BE */ u16 startBlock;
/* 0x0C0 */ CARDFileInfo* fileInfo;
/* 0x0C4 */ CARDCallback extCallback;
/* 0x0C8 */ CARDCallback txCallback;
/* 0x0CC */ CARDCallback exiCallback;
/* 0x0D0 */ CARDCallback apiCallback;
/* 0x0D4 */ CARDCallback xferCallback;
/* 0x0D8 */ CARDCallback eraseCallback;
/* 0x0DC */ CARDCallback unlockCallback;
/* 0x0E0 */ OSAlarm alarm;
/* 0x108 */ u32 cid;
/* 0x10C */ const DVDDiskID* diskID;
} CARDControl;
typedef struct CARDDecParam {
/* 0x00 */ u8* inputAddr;
/* 0x04 */ u32 inputLength;
/* 0x08 */ u32 aramAddr;
/* 0x0C */ u8* outputAddr;
} CARDDecParam;
typedef struct CARDID {
/* 0x000 */ u8 serial[32];
/* 0x020 */ u16 deviceID;
/* 0x022 */ u16 size;
/* 0x024 */ u16 encode;
/* 0x026 */ u8 padding[470];
/* 0x1FC */ u16 checkSum;
/* 0x1FE */ u16 checkSumInv;
} CARDID;
typedef struct CARDDirCheck {
/* 0x00 */ u8 padding0[56];
/* 0x38 */ u16 padding1;
/* 0x3A */ s16 checkCode;
/* 0x3C */ u16 checkSum;
/* 0x3E */ u16 checkSumInv;
} CARDDirCheck;
typedef struct CARDStat {
/* 0x00 */ char fileName[CARD_FILENAME_MAX];
/* 0x20 */ u32 length;
/* 0x24 */ u32 time;
/* 0x28 */ u8 gameName[4];
/* 0x2C */ u8 company[2];
/* 0x2E */ u8 bannerFormat;
/* 0x30 */ u32 iconAddr;
/* 0x34 */ u16 iconFormat;
/* 0x36 */ u16 iconSpeed;
/* 0x38 */ u32 commentAddr;
/* 0x3C */ u32 offsetBanner;
/* 0x40 */ u32 offsetBannerTlut;
/* 0x44 */ u32 offsetIcon[CARD_ICON_MAX];
/* 0x64 */ u32 offsetIconTlut;
/* 0x68 */ u32 offsetData;
} CARDStat;
#define CARD_ATTR_PUBLIC 0x04u
#define CARD_ATTR_NO_COPY 0x08u
#define CARD_ATTR_NO_MOVE 0x10u
#define CARD_ATTR_GLOBAL 0x20u
#define CARD_ATTR_COMPANY 0x40u
#define CARD_FAT_AVAIL 0x0000u
#define CARD_FAT_CHECKSUM 0x0000u
#define CARD_FAT_CHECKSUMINV 0x0001u
#define CARD_FAT_CHECKCODE 0x0002u
#define CARD_FAT_FREEBLOCKS 0x0003u
#define CARD_FAT_LASTSLOT 0x0004u
#define CARD_WORKAREA_SIZE (5 * 8 * 1024)
#define CARD_SEG_SIZE 0x200u
#define CARD_PAGE_SIZE 0x80u
#define CARD_MAX_SIZE 0x01000000U
#define CARD_NUM_SYSTEM_BLOCK 5
#define CARD_SYSTEM_BLOCK_SIZE (8 * 1024u)
#define CARD_MAX_MOUNT_STEP (CARD_NUM_SYSTEM_BLOCK + 2)
#define CARD_STAT_SPEED_END 0
#define CARD_STAT_SPEED_FAST 1
#define CARD_STAT_SPEED_MIDDLE 2
#define CARD_STAT_SPEED_SLOW 3
#define CARD_STAT_SPEED_MASK 3
#define CARD_STAT_ANIM_LOOP 0
#define CARD_STAT_ANIM_BOUNCE 4
#define CARD_STAT_ANIM_MASK 0x4
#define CARD_RESULT_UNLOCKED 1
#define CARD_RESULT_READY 0
#define CARD_RESULT_BUSY -1
#define CARD_RESULT_WRONGDEVICE -2
#define CARD_RESULT_NOCARD -3
#define CARD_RESULT_NOFILE -4
#define CARD_RESULT_IOERROR -5
#define CARD_RESULT_BROKEN -6
#define CARD_RESULT_EXIST -7
#define CARD_RESULT_NOENT -8
#define CARD_RESULT_INSSPACE -9
#define CARD_RESULT_NOPERM -10
#define CARD_RESULT_LIMIT -11
#define CARD_RESULT_NAMETOOLONG -12
#define CARD_RESULT_ENCODING -13
#define CARD_RESULT_CANCELED -14
#define CARD_RESULT_FATAL_ERROR -128
#define CARDIsValidBlockNo(card, blockNo) ((blockNo) >= CARD_NUM_SYSTEM_BLOCK && (blockNo) < (card)->cBlock)
#define CARD_READ_SIZE 512
#define CARD_COMMENT_SIZE 64
#define CARD_ICON_WIDTH 32
#define CARD_ICON_HEIGHT 32
#define CARD_BANNER_WIDTH 96
#define CARD_BANNER_HEIGHT 32
#define CARD_STAT_ICON_NONE 0
#define CARD_STAT_ICON_C8 1
#define CARD_STAT_ICON_RGB5A3 2
#define CARD_STAT_ICON_MASK 3
#define CARD_STAT_BANNER_NONE 0
#define CARD_STAT_BANNER_C8 1
#define CARD_STAT_BANNER_RGB5A3 2
#define CARD_STAT_BANNER_MASK 3
#define CARD_ENCODE_ANSI 0
#define CARD_ENCODE_SJIS 1
#define CARDGetDirCheck(dir) ((CARDDirCheck*)&(dir)[CARD_MAX_FILE])
#define CARDGetBannerFormat(stat) (((stat)->bannerFormat) & CARD_STAT_BANNER_MASK)
#define CARDGetIconAnim(stat) (((stat)->bannerFormat) & CARD_STAT_ANIM_MASK)
#define CARDGetIconFormat(stat, n) (((stat)->iconFormat >> (2 * (n))) & CARD_STAT_ICON_MASK)
#define CARDGetIconSpeed(stat, n) (((stat)->iconSpeed >> (2 * (n))) & CARD_STAT_SPEED_MASK)
#define CARDSetBannerFormat(stat, f) \
((stat)->bannerFormat = (u8)(((stat)->bannerFormat & ~CARD_STAT_BANNER_MASK) | (f)))
#define CARDSetIconAnim(stat, f) \
((stat)->bannerFormat = (u8)(((stat)->bannerFormat & ~CARD_STAT_ANIM_MASK) | (f)))
#define CARDSetIconFormat(stat, n, f) \
((stat)->iconFormat = \
(u16)(((stat)->iconFormat & ~(CARD_STAT_ICON_MASK << (2 * (n)))) | ((f) << (2 * (n)))))
#define CARDSetIconSpeed(stat, n, f) \
((stat)->iconSpeed = \
(u16)(((stat)->iconSpeed & ~(CARD_STAT_SPEED_MASK << (2 * (n)))) | ((f) << (2 * (n)))))
#define CARDSetIconAddress(stat, addr) ((stat)->iconAddr = (u32)(addr))
#define CARDSetCommentAddress(stat, addr) ((stat)->commentAddr = (u32)(addr))
#define CARDGetFileNo(fileInfo) ((fileInfo)->fileNo)
extern u32 __CARDFreq;
#if DEBUG
#define CARDFreq __CARDFreq
#else
#define CARDFreq EXI_FREQ_16M
#endif
void CARDInit(void);
s32 CARDGetResultCode(s32 chan);
s32 CARDCheckAsync(s32 chan, CARDCallback callback);
s32 CARDFreeBlocks(s32 chan, s32* byteNotUsed, s32* filesNotUsed);
s32 CARDRenameAsync(s32 chan, const char* oldName, const char* newName, CARDCallback callback);
// CARDBios
void CARDInit(void);
s32 CARDGetResultCode(s32 chan);
s32 CARDFreeBlocks(s32 chan, s32* byteNotUsed, s32* filesNotUsed);
s32 CARDGetEncoding(s32 chan, u16* encode);
s32 CARDGetMemSize(s32 chan, u16* size);
s32 CARDGetSectorSize(s32 chan, u32* size);
const DVDDiskID* CARDGetDiskID(s32 chan);
s32 CARDSetDiskID(s32 chan, const DVDDiskID* diskID);
BOOL CARDSetFastMode(BOOL enable);
BOOL CARDGetFastMode(void);
s32 CARDGetCurrentMode(s32 chan, u32* mode);
// CARDCheck
s32 CARDCheckExAsync(s32 chan, s32* xferBytes, CARDCallback callback);
s32 CARDCheckAsync(s32 chan, CARDCallback callback);
s32 CARDCheckEx(s32 chan, s32* xferBytes);
s32 CARDCheck(s32 chan);
// CARDCreate
s32 CARDCreateAsync(s32 chan, const char* fileName, u32 size, CARDFileInfo* fileInfo, CARDCallback callback);
s32 CARDCreate(s32 chan, const char* fileName, u32 size, CARDFileInfo* fileInfo);
// CARDDelete
s32 CARDFastDeleteAsync(s32 chan, s32 fileNo, CARDCallback callback);
s32 CARDFastDelete(s32 chan, s32 fileNo);
s32 CARDDeleteAsync(s32 chan, const char* fileName, CARDCallback callback);
s32 CARDDelete(s32 chan, const char* fileName);
// CARDErase
s32 CARDEraseAsync(CARDFileInfo* fileInfo, s32 length, s32 offset, CARDCallback callback);
s32 CARDErase(CARDFileInfo* fileInfo, s32 length, s32 offset);
// CARDFormat
s32 CARDFormat(s32 chan);
// CARDMount
int CARDProbe(s32 chan);
s32 CARDProbeEx(s32 chan, s32* memSize, s32* sectorSize);
s32 CARDMountAsync(s32 chan, void* workArea, CARDCallback detachCallback, CARDCallback attachCallback);
s32 CARDMount(s32 chan, void* workArea, CARDCallback detachCallback);
s32 CARDUnmount(s32 chan);
// CARDNet
u16 CARDSetVendorID(u16 vendorID);
u16 CARDGetVendorID();
s32 CARDGetSerialNo(s32 chan, u64* serialNo);
s32 CARDGetUniqueCode(s32 chan, u64* uniqueCode);
s32 CARDGetAttributes(s32 chan, s32 fileNo, u8* attr);
s32 CARDSetAttributesAsync(s32 chan, s32 fileNo, u8 attr, CARDCallback callback);
s32 CARDSetAttributes(s32 chan, s32 fileNo, u8 attr);
// CARDOpen
s32 CARDFastOpen(s32 chan, s32 fileNo, CARDFileInfo* fileInfo);
s32 CARDOpen(s32 chan, const char* fileName, CARDFileInfo* fileInfo);
s32 CARDClose(CARDFileInfo* fileInfo);
// CARDProgram
s32 CARDProgramAsync(CARDFileInfo* fileInfo, void* buf, s32 length, s32 offset, CARDCallback callback);
s32 CARDProgram(CARDFileInfo* fileInfo, void* buf, s32 length, s32 offset);
// CARDRdwr
s32 CARDGetXferredBytes(s32 chan);
// CARDRead
s32 CARDReadAsync(CARDFileInfo* fileInfo, void* buf, s32 length, s32 offset, CARDCallback callback);
s32 CARDRead(CARDFileInfo* fileInfo, void* buf, s32 length, s32 offset);
s32 CARDCancel(CARDFileInfo* fileInfo);
// CARDRename
s32 CARDRename(s32 chan, const char* oldName, const char* newName);
// CARDStat
s32 CARDGetStatus(s32 chan, s32 fileNo, CARDStat* stat);
s32 CARDSetStatusAsync(s32 chan, s32 fileNo, CARDStat* stat, CARDCallback callback);
s32 CARDSetStatus(s32 chan, s32 fileNo, CARDStat* stat);
// CARDWrite
s32 CARDWriteAsync(CARDFileInfo* fileInfo, void* buf, s32 length, s32 offset, CARDCallback callback);
s32 CARDWrite(CARDFileInfo* fileInfo, void* buf, s32 length, s32 offset);
#ifdef __cplusplus
}
#endif
#endif
+8 -5
View File
@@ -3,7 +3,7 @@
#include "Z2AudioLib/Z2Calc.h"
#include "Z2AudioLib/Z2AudioMgr.h"
#include "os_report.h"
#include "dusk/logging.h"
#include "dusk/audio.h"
static void Z2_E_sw_modPitch(Z2SoundHandlePool*, u32);
static void Z2_E_ms_modVol(Z2SoundHandlePool*, u32);
@@ -139,10 +139,7 @@ void Z2Creature::setSoundStarter(Z2SoundStarter* soundStarter) {
}
void Z2Creature::initAnime(void* animation, bool param_1, f32 startFrame, f32 param_3) {
#if TARGET_PC
STUB_LOG();
return;
#endif
DUSK_AUDIO_SKIP();
mSoundObjAnime.initAnime(animation, param_1, startFrame, param_3);
}
@@ -182,6 +179,8 @@ Z2SoundHandlePool* Z2Creature::startCreatureSound(JAISoundID soundID, u32 mapinf
}
Z2SoundHandlePool* Z2Creature::startCreatureSoundLevel(JAISoundID soundID, u32 mapinfo, s8 reverb) {
DUSK_AUDIO_SKIP(NULL);
switch (soundID) {
case Z2SE_FAIRY_S_LV:
Z2GetAudioMgr()->seStartLevel(soundID, mpPos, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0);
@@ -441,6 +440,8 @@ Z2SoundHandlePool* Z2CreatureEnemy::startCreatureSound(JAISoundID soundID, u32 m
}
Z2SoundHandlePool* Z2CreatureEnemy::startCreatureSoundLevel(JAISoundID soundID, u32 mapinfo, s8 reverb) {
DUSK_AUDIO_SKIP(NULL);
if (soundID == 0x7FFFF) {
Vec pos;
Z2GetAudience()->convertAbsToRel(*mpPos, &pos, 0);
@@ -924,6 +925,8 @@ void Z2CreatureOI::framework(u32 mapinfo, s8 reverb) {
}
Z2SoundHandlePool* Z2CreatureOI::startCreatureSoundLevel(JAISoundID soundID, u32 mapinfo, s8 reverb) {
DUSK_AUDIO_SKIP(NULL);
if (soundID == Z2SE_EN_OI_MOVE) {
Z2SoundHandlePool* handle1 = mSoundObjAnime.startLevelSound(soundID, mapinfo, reverb);
Z2SoundHandlePool* handle2 = field_0xa4.startLevelSound(soundID, mapinfo, reverb);
+8
View File
@@ -10,6 +10,8 @@
#include "JSystem/JAudio2/JAISeq.h"
#include "os_report.h"
#include "dusk/audio.h"
static const char* sSpotName[] = {
"F_SP00",
"F_SP103",
@@ -131,6 +133,8 @@ Z2SeqMgr::Z2SeqMgr() : JASGlobalInstance<Z2SeqMgr>(true) {
}
void Z2SeqMgr::bgmStart(u32 bgmID, u32 fadeTime, s32 param_2) {
DUSK_AUDIO_SKIP();
switch (bgmID) {
case 0xFFFFFFFF:
return;
@@ -591,6 +595,8 @@ static void dummy1() {
}
void Z2SeqMgr::bgmStreamPrepare(u32 bgmID) {
DUSK_AUDIO_SKIP();
u32 bgmID2 = bgmID;
if (mStreamBgmHandle) {
bgmStreamStop(0);
@@ -648,6 +654,8 @@ bool Z2SeqMgr::bgmStreamCheckReady() {
}
void Z2SeqMgr::bgmStreamPlay() {
DUSK_AUDIO_SKIP();
if (mStreamBgmHandle) {
mStreamBgmHandle->unlockIfLocked();
}
+4 -2
View File
@@ -117,6 +117,8 @@ Z2SoundMgr::Z2SoundMgr() :
}
bool Z2SoundMgr::startSound(JAISoundID soundID, JAISoundHandle* handle, const JGeometry::TVec3<f32>* posPtr) {
DUSK_AUDIO_SKIP(true);
int soundType = Z2GetSoundInfo()->getSoundType(soundID);
switch (soundType) {
case 0: {
@@ -180,8 +182,8 @@ bool Z2SoundMgr::startSound(JAISoundID soundID, JAISoundHandle* handle, const JG
}
return streamMgr_.startSound(soundID, handle, posPtr);
default:
char error[32];
sprintf(error, "Unknown Sound-Type id :%08x\n", *(u32*)&soundID);
char error[64];
sprintf(error, "Unknown Sound-Type id :%08x\n", (u32)soundID);
JUT_WARN(277, "%s", error);
}
+12
View File
@@ -9,6 +9,8 @@
#include "Z2AudioLib/Z2Audience.h"
#include "JSystem/JAudio2/JAUSoundAnimator.h"
#include "dusk/audio.h"
#ifndef __MWERKS__
#include <limits>
#define FLT_MAX std::numeric_limits<float>::max()
@@ -88,6 +90,8 @@ bool Z2SoundObjBase::stopOK(Z2SoundHandlePool& handlePool) {
}
Z2SoundHandlePool* Z2SoundObjBase::startSound(JAISoundID soundID, u32 mapinfo, s8 reverb) {
DUSK_AUDIO_SKIP(NULL);
if (!alive_) {
return NULL;
}
@@ -248,6 +252,8 @@ void Z2DopplerSoundObjBase::framework(u32 param_0, s8 reverb) {
}
Z2SoundHandlePool* Z2DopplerSoundObjBase::startSound(JAISoundID soundID, u32 mapinfo, s8 reverb) {
DUSK_AUDIO_SKIP(NULL);
JGeometry::TVec3<f32>* pos = pos_;
pos_ = NULL;
@@ -263,6 +269,8 @@ Z2SoundHandlePool* Z2DopplerSoundObjBase::startSound(JAISoundID soundID, u32 map
}
Z2SoundHandlePool* Z2DopplerSoundObjBase::startLevelSound(JAISoundID soundID, u32 mapinfo, s8 reverb) {
DUSK_AUDIO_SKIP(NULL);
JGeometry::TVec3<f32>* pos = pos_;
pos_ = NULL;
@@ -284,6 +292,8 @@ void Z2SoundObjSimple::init(Vec* posPtr, u8 handleNum) {
}
Z2SoundHandlePool* Z2SoundObjSimple::startSound(JAISoundID soundID, u32 mapinfo, s8 reverb) {
DUSK_AUDIO_SKIP(NULL);
Z2SoundHandlePool* handle = Z2SoundObjBase::startSound(soundID, mapinfo, reverb);
if (soundID == Z2SE_AL_UKI_POKOPOKO && handle != NULL && (*handle) != false) {
@@ -297,6 +307,8 @@ Z2SoundHandlePool* Z2SoundObjSimple::startSound(JAISoundID soundID, u32 mapinfo,
}
Z2SoundHandlePool* Z2SoundObjSimple::startLevelSound(JAISoundID soundID, u32 mapinfo, s8 reverb) {
DUSK_AUDIO_SKIP(NULL);
Z2SoundHandlePool* handle = Z2SoundObjBase::startLevelSound(soundID, mapinfo, reverb);
if (handle != NULL && (*handle) != false) {
+6 -1
View File
@@ -8,6 +8,7 @@
#include "d/actor/d_a_alink.h"
#include "d/d_com_inf_game.h"
#include "d/d_k_wmark.h"
#include "dusk/gx_helper.h"
const EffParamProc daAlink_c::m_fEffParamProc[] = {
&daAlink_c::setEffectFrontRollParam,
@@ -2025,7 +2026,11 @@ void daAlink_blur_c::traceBlur(cXyz const* param_0, cXyz const* param_1, s16 par
void daAlink_blur_c::draw() {
j3dSys.reinitGX();
static GXTexObj texObj;
#ifdef TARGET_PC
TGXTexObj texObj;
#else
static TGXTexObj texObj;
#endif
static GXColor nColor0 = {0xFF, 0xFF, 0xFF, 0x14};
GXSetNumIndStages(0);
+1 -1
View File
@@ -134,7 +134,7 @@ int daE_BG_c::draw() {
cXyz offsetPos;
offsetPos.set(current.pos.x, current.pos.y + 100.0f, current.pos.z);
GXTexObj* texObj = dDlst_shadowControl_c::getSimpleTex();
TGXTexObj* texObj = dDlst_shadowControl_c::getSimpleTex();
mShadowKey = dComIfGd_setShadow(mShadowKey, 0x01, model, &offsetPos, 200.0f, 0.0f, current.pos.y,
mObjAcch.GetGroundH(), mObjAcch.m_gnd, &tevStr, 0, 1.0f, texObj);
+6
View File
@@ -6581,6 +6581,12 @@ static int daE_RD_Execute(e_rd_class* i_this) {
for (int i = 0; i < 2; i++) {
MtxPush();
s16 x, y;
#if AVOID_UB
x = 0;
y = 0;
#endif
if (i == 0) {
mae.set(38.0f, 0.0f, 0.0f);
MtxPosition(&mae, &ato);
+1 -1
View File
@@ -1048,7 +1048,7 @@ int daE_SB_c::Draw() {
mpMorf->entryDL();
cXyz my_vec;
my_vec.set(current.pos.x, 100.0f + current.pos.y, current.pos.z);
GXTexObj* tex_obj = dDlst_shadowControl_c::getSimpleTex();
TGXTexObj* tex_obj = dDlst_shadowControl_c::getSimpleTex();
mShadowKey = dComIfGd_setShadow(mShadowKey, 1, model, &my_vec, 1000.0f, 300.0f,
current.pos.y, mAcch.GetGroundH(), mAcch.m_gnd,
&tevStr, 0, 1.0f, tex_obj);
+1 -1
View File
@@ -93,7 +93,7 @@ static int daE_SG_Draw(e_sg_class* i_this) {
cXyz shadow_pos(i_this->current.pos.x, i_this->current.pos.y + 100.0f,
i_this->current.pos.z);
GXTexObj* tex_obj = dDlst_shadowControl_c::getSimpleTex();
TGXTexObj* tex_obj = dDlst_shadowControl_c::getSimpleTex();
i_this->mShadowKey =
dComIfGd_setShadow(i_this->mShadowKey, 1, i_this->mpModel, &shadow_pos, 400.0f, 0.0f,
+2 -2
View File
@@ -320,8 +320,8 @@ void daFmtMng_c::executeFight() {
}
}
static bool daFmtMng_Draw(daFmtMng_c* param_0) {
return true;
static BOOL daFmtMng_Draw(daFmtMng_c* param_0) {
return TRUE;
}
static int daFmtMng_Execute(daFmtMng_c* param_0) {
+4
View File
@@ -82,6 +82,10 @@ static int daKytag12_Execute_standard(kytag12_class* i_this) {
f32 var_f29;
f32 var_f28;
#if AVOID_UB
var_f30 = 0;
#endif
int var_r24 = 0;
int var_r23 = 0;
int var_r22 = 0;
+4 -1
View File
@@ -298,7 +298,7 @@ void daMant_packet_c::draw() {
GXTlutObj GStack_80;
GXInitTlutObj(&GStack_80, lut, GX_TL_RGB5A3, 0x100);
GXTexObj GStack_74;
TGXTexObj GStack_74;
GXInitTexObjCI(&GStack_74, image, 0x80, 0x80, GX_TF_C8, GX_CLAMP, GX_CLAMP, 0, 0);
GXInitTexObjLOD(&GStack_74, GX_LINEAR, GX_LINEAR, 0.0, 0.0, 0.0, 0, 0, GX_ANISO_1);
@@ -314,6 +314,9 @@ void daMant_packet_c::draw() {
GXLoadNrmMtxImm(MStack_54, GX_PNMTX0);
GXCallDisplayList(l_Egnd_mantDL, 0x3e0);
#ifdef TARGET_PC
GStack_74.reset();
#endif
GXInitTexObjCI(&GStack_74, l_Egnd_mantTEX_U, 0x80, 0x80, GX_TF_C8, GX_CLAMP, GX_CLAMP, 0, 0);
GXInitTexObjLOD(&GStack_74, GX_LINEAR, GX_LINEAR, 0.0, 0.0, 0.0, 0, 0, GX_ANISO_1);
GXLoadTexObj(&GStack_74, GX_TEXMAP0);
+5 -3
View File
@@ -22,6 +22,8 @@
#include "f_op/f_op_overlap_mng.h"
#include <cstring>
#include "dusk/gx_helper.h"
inline s32 daMP_NEXT_READ_SIZE(daMP_THPReadBuffer* readBuf) {
return *(s32*)readBuf->ptr;
}
@@ -3155,9 +3157,9 @@ static void daMP_THPGXYuv2RgbSetup(const GXRenderModeObj* rmode) {
static void daMP_THPGXYuv2RgbDraw(u8* y_data, u8* u_data, u8* v_data, s16 x,
s16 y, s16 textureWidth, s16 textureHeight, s16 polygonWidth,
s16 polygonHeight) {
GXTexObj tobj0;
GXTexObj tobj1;
GXTexObj tobj2;
TGXTexObj tobj0;
TGXTexObj tobj1;
TGXTexObj tobj2;
GXInitTexObj(&tobj0, y_data, textureWidth, textureHeight, GX_TF_I8, GX_CLAMP, GX_CLAMP, GX_FALSE);
GXInitTexObjLOD(&tobj0, GX_NEAR, GX_NEAR, 0.0f, 0.0f, 0.0f, 0, 0, GX_ANISO_1);
+8 -8
View File
@@ -7,20 +7,20 @@
#include "d/actor/d_a_npc_mk.h"
static bool daNpc_Mk_Create(void* param_0) {
return true;
static BOOL daNpc_Mk_Create(void* param_0) {
return TRUE;
}
static bool daNpc_Mk_Delete(void* param_0) {
return true;
static BOOL daNpc_Mk_Delete(void* param_0) {
return TRUE;
}
static bool daNpc_Mk_Execute(void* param_0) {
return true;
static BOOL daNpc_Mk_Execute(void* param_0) {
return TRUE;
}
static bool daNpc_Mk_Draw(void* param_0) {
return true;
static BOOL daNpc_Mk_Draw(void* param_0) {
return TRUE;
}
static BOOL daNpc_Mk_IsDelete(void* param_0) {
+8 -8
View File
@@ -7,20 +7,20 @@
#include "d/actor/d_a_npc_p2.h"
static bool daNpc_P2Create(void* param_0) {
return true;
static BOOL daNpc_P2Create(void* param_0) {
return TRUE;
}
static bool daNpc_P2Delete(void* param_0) {
return true;
static BOOL daNpc_P2Delete(void* param_0) {
return TRUE;
}
static bool daNpc_P2Execute(void* param_0) {
return true;
static BOOL daNpc_P2Execute(void* param_0) {
return TRUE;
}
static bool daNpc_P2Draw(void* param_0) {
return true;
static BOOL daNpc_P2Draw(void* param_0) {
return TRUE;
}
static BOOL daNpc_P2IsDelete(void* param_0) {
+4 -4
View File
@@ -16,12 +16,12 @@ static int daNpc_shopMaro_Delete(void* i_this) {
return 1;
}
static bool daNpc_shopMaro_Execute(void* i_this) {
return false;
static BOOL daNpc_shopMaro_Execute(void* i_this) {
return FALSE;
}
static bool daNpc_shopMaro_Draw(void* i_this) {
return false;
static BOOL daNpc_shopMaro_Draw(void* i_this) {
return FALSE;
}
static BOOL daNpc_shopMaro_IsDelete(void* i_this) {
+2 -2
View File
@@ -485,8 +485,8 @@ static void daNpc_solA_Draw(void* param_0) {
return static_cast<daNpc_solA_c*>(param_0)->Draw();
}
static bool daNpc_solA_IsDelete(void* param_0) {
return true;
static BOOL daNpc_solA_IsDelete(void* param_0) {
return TRUE;
}
static actor_method_class daNpc_solA_MethodTable = {
+2 -2
View File
@@ -1338,7 +1338,7 @@ static int daObj_Brg_Execute(obj_brg_class* i_this) {
i_this->mpBgW->CopyBackVtx();
Vec* vtx_tbl = (Vec*)i_this->mpBgW->GetVtxTbl();
BE(Vec)* vtx_tbl = (BE(Vec)*)i_this->mpBgW->GetVtxTbl();
int dbg_0x30;
int temp;
@@ -1622,7 +1622,7 @@ static int CallbackCreateHeap(fopAc_ac_c* i_this) {
a_this->mpBgW->SetRideCallback(ride_call_back);
a_this->mpBgW->CopyBackVtx();
Vec* vtx_tbl = (Vec*)a_this->mpBgW->GetVtxTbl();
BE(Vec)* vtx_tbl = (BE(Vec)*)a_this->mpBgW->GetVtxTbl();
for (int i = 0; i < a_this->mpBgW->GetVtxNum(); i++) {
vtx_tbl[i] = i_this->current.pos;
}
+2 -2
View File
@@ -259,8 +259,8 @@ static int daObjFlag_Execute(daObjFlag_c* param_0) {
return param_0->execute();
}
static bool daObjFlag_IsDelete(daObjFlag_c* param_0) {
return true;
static BOOL daObjFlag_IsDelete(daObjFlag_c* param_0) {
return TRUE;
}
static int daObjFlag_Delete(daObjFlag_c* param_0) {
+1 -1
View File
@@ -530,7 +530,7 @@ int daObj_KBacket_c::Draw() {
} else {
cM3dGPla plane;
if (dComIfG_Bgsp().GetTriPla(mGndChk, &plane) != 0) {
GXTexObj* p_Var4 = dDlst_shadowControl_c::getSimpleTex();
TGXTexObj* p_Var4 = dDlst_shadowControl_c::getSimpleTex();
dComIfGd_setSimpleShadow(&current.pos, field_0xa00, 50.0f,
&plane.mNormal, 0, 1.0f, p_Var4);
}
+1 -1
View File
@@ -980,7 +980,7 @@ int daObjStone_c::draw() {
if (!model) {
f32 shadow_size = l_shadow_size[mStoneType];
GXTexObj* pTex = dDlst_shadowControl_c::getSimpleTex();
TGXTexObj* pTex = dDlst_shadowControl_c::getSimpleTex();
cXyz pos = current.pos;
dComIfGd_setSimpleShadow(&pos, mChkObj.GetGroundH(), shadow_size, mChkObj.m_gnd, 0,
+1 -1
View File
@@ -366,7 +366,7 @@ JKRHeap* daPy_anmHeap_c::setAnimeHeap() {
#include "assets/l_sightDL__d_a_player.h"
void daPy_sightPacket_c::draw() {
GXTexObj texObj;
TGXTexObj texObj;
j3dSys.reinitGX();
GXSetNumIndStages(0);
+4
View File
@@ -1017,6 +1017,10 @@ void dCamera_c::debugDrawInit() {
}
bool dCamera_c::Run() {
#if TARGET_PC
ResetView();
#endif
daAlink_c* link = daAlink_getAlinkActorClass();
daMidna_c* midna = daPy_py_c::getMidnaActor();
mMidnaRidingAndVisible = link->checkMidnaRide() && !midna->checkNoDraw();
+2 -2
View File
@@ -1366,7 +1366,7 @@ s8 dComIfGp_getReverb(int i_roomNo) {
}
int dComIfGd_setSimpleShadow(cXyz* i_pos, f32 param_1, f32 param_2, cBgS_PolyInfo& param_3,
s16 i_angle, f32 param_5, GXTexObj* i_tex) {
s16 i_angle, f32 param_5, TGXTexObj* i_tex) {
if (param_3.ChkSetInfo() && -G_CM3D_F_INF != param_1) {
cM3dGPla plane;
dComIfG_Bgsp().GetTriPla(param_3, &plane);
@@ -2256,7 +2256,7 @@ void dComIfGp_addSelectItemNum(int i_selItemIdx, s16 i_num) {
int dComIfGd_setShadow(u32 param_0, s8 param_1, J3DModel* param_2, cXyz* param_3, f32 param_4,
f32 param_5, f32 param_6, f32 param_7, cBgS_PolyInfo& param_8,
dKy_tevstr_c* param_9, s16 param_10, f32 param_11, GXTexObj* param_12) {
dKy_tevstr_c* param_9, s16 param_10, f32 param_11, TGXTexObj* param_12) {
if (param_7 <= -G_CM3D_F_INF) {
return 0;
} else {
+1 -2
View File
@@ -22,7 +22,7 @@ void jstudio_tAdaptor_message::adaptor_do_MESSAGE(JStudio::data::TEOperationData
case JStudio::data::UNK_0x19: {
JUT_ASSERT(107, pContent!=NULL);
JUT_ASSERT(108, uSize==4);
u32 content = *(u32*)pContent;
u32 content = *(BE(u32)*)pContent;
dMsgObject_setDemoMessage(content);
break;
}
@@ -215,7 +215,6 @@ int dDemo_actor_c::getDemoIDData(int* o_arg0, int* o_arg1, int* o_arg2, u16* o_r
}
u32 var_r31 = *it;
be_swap(var_r31);
*o_arg0 = var_r31 >> 0x1E;
*o_arg1 = (var_r31 >> 0x18) & 0xF;
*o_arg2 = (var_r31 >> 0x10) & 0xF;
+18 -19
View File
@@ -11,10 +11,11 @@
#include "d/d_com_inf_game.h"
#include "d/d_drawlist.h"
#include "d/d_s_play.h"
#include "dusk/gx_helper.h"
#include "dusk/logging.h"
#include "m_Do/m_Do_graphic.h"
#include "m_Do/m_Do_lib.h"
#include "m_Do/m_Do_mtx.h"
#include "dusk/logging.h"
class dDlst_2Dm_c {
public:
@@ -28,12 +29,12 @@ public:
/* 0x10 */ f32 field_0x10;
/* 0x14 */ GXColor field_0x14;
/* 0x18 */ GXColor field_0x18;
/* 0x1C */ GXTexObj field_0x1c;
/* 0x1C */ TGXTexObj field_0x1c;
/* 0x3C */ GXTlutObj field_0x3c;
/* 0x48 */ s16 field_0x48;
/* 0x4A */ s16 field_0x4a;
/* 0x4C */ u8 field_0x4c;
/* 0x50 */ GXTexObj field_0x50;
/* 0x50 */ TGXTexObj field_0x50;
/* 0x70 */ GXTlutObj field_0x70;
/* 0x7C */ s16 field_0x7c;
/* 0x7E */ s16 field_0x7e;
@@ -87,7 +88,7 @@ class dDlst_2DMt_tex_c {
public:
u8 check() { return field_0x0; }
int getCI() { return mCI; }
GXTexObj* getTexObj() { return &mTexObj; }
TGXTexObj* getTexObj() { return &mTexObj; }
GXTlutObj* getTlutObj() { return &mTlutObj; }
GXColor* getColor() { return &mColor; }
f32 getS() { return mS; }
@@ -97,7 +98,7 @@ public:
/* 0x00 */ u8 field_0x0;
/* 0x01 */ u8 mCI;
/* 0x04 */ GXTexObj mTexObj;
/* 0x04 */ TGXTexObj mTexObj;
/* 0x24 */ GXTlutObj mTlutObj;
/* 0x30 */ GXColor mColor;
/* 0x34 */ f32 mS;
@@ -266,7 +267,7 @@ void dDlst_2DT_c::draw() {
u16 var3 = (field_0x1c + var11) / var5 * 32768.0f;
u16 var4 = (field_0x20 + var12) / var6 * 32768.0f;
GXTexObj tex;
TGXTexObj tex;
GXInitTexObj(&tex, field_0x4, field_0xe, field_0x10, (GXTexFmt)field_0xc, GX_CLAMP, GX_CLAMP, GX_FALSE);
GXInitTexObjLOD(&tex, GX_LINEAR, GX_LINEAR, 0.0, 0.0, 0.0, 0, 0, GX_ANISO_1);
GXLoadTexObj(&tex, GX_TEXMAP0);
@@ -311,9 +312,6 @@ void dDlst_2DT_c::draw() {
GXEnd();
GXSetClipMode(GX_CLIP_ENABLE);
dComIfGp_getCurrentGrafPort()->setup2D();
#if TARGET_PC
GXDestroyTexObj(&tex);
#endif
}
void dDlst_2DT2_c::draw() {
@@ -666,7 +664,7 @@ void dDlst_2DM_c::draw() {
int r26 = field_0x34 * f3;
s16 r25 = r27 + s16(field_0x1e * f4);
s16 r24 = r26 + s16(field_0x20 * f3);
GXTexObj tex[2];
TGXTexObj tex[2];
void** stack_1c = &field_0x18;
GXInitTexObj(&tex[0], field_0x18, field_0x1e, field_0x20, GXTexFmt(field_0x1c), GX_CLAMP, GX_CLAMP, 0);
GXInitTexObjLOD(&tex[0], GX_LINEAR, GX_LINEAR, 0.0, 0.0, 0.0, 0, 0, GX_ANISO_1);
@@ -715,10 +713,6 @@ void dDlst_2DM_c::draw() {
GXTexCoord2s16(r27, r24);
GXEnd();
dComIfGp_getCurrentGrafPort()->setup2D();
#if TARGET_PC
GXDestroyTexObj(&tex[0]);
GXDestroyTexObj(&tex[1]);
#endif
}
@@ -733,7 +727,7 @@ void dDlst_2Dm_c::draw() {
int r26 = field_0x7e * f30;
s16 r25 = r27 + s16(f31 * GXGetTexObjWidth(&field_0x1c));
s16 r24 = r26 + s16(f30 * GXGetTexObjHeight(&field_0x1c));
GXTexObj* stack_18 = &field_0x1c;
TGXTexObj* stack_18 = &field_0x1c;
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_S16, 0);
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_RGBA4, 8);
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX1, GX_CLR_RGBA, GX_RGBA4, 8);
@@ -1347,7 +1341,7 @@ void dDlst_shadowSimple_c::draw() {
}
void dDlst_shadowSimple_c::set(cXyz* param_0, f32 param_1, f32 param_2, cXyz* param_3,
s16 param_4, f32 param_5, GXTexObj* param_6) {
s16 param_4, f32 param_5, TGXTexObj* param_6) {
if (param_5 < 0.0f) {
mAlpha = param_5 * -255.0f;
param_5 = 1.0f;
@@ -1424,6 +1418,11 @@ void dDlst_shadowControl_c::reset() {
mSimpleNum = 0;
mRealNum = 0;
field_0x4 = NULL;
#ifdef TARGET_PC
field_0x15eb0[0].reset();
field_0x15eb0[1].reset();
#endif
}
void dDlst_shadowControl_c::imageDraw(Mtx param_0) {
@@ -1529,7 +1528,7 @@ void dDlst_shadowControl_c::draw(Mtx param_0) {
for (int i2 = 0, i3 = 0; real != NULL; real = real->getZsortNext()) {
if (real->isUse()) {
if (i2 == 0) {
GXTexObj* obj = &field_0x15eb0[i3];
TGXTexObj* obj = &field_0x15eb0[i3];
i3++;
GXLoadTexObj(obj, GX_TEXMAP0);
@@ -1671,7 +1670,7 @@ bool dDlst_shadowControl_c::addReal(u32 i_key, J3DModel* param_1) {
}
int dDlst_shadowControl_c::setSimple(cXyz* param_0, f32 param_1, f32 param_2, cXyz* param_3,
s16 param_4, f32 param_5, GXTexObj* param_6) {
s16 param_4, f32 param_5, TGXTexObj* param_6) {
if (param_3 == NULL || mSimpleNum >= 128) {
return 0;
}
@@ -1681,7 +1680,7 @@ int dDlst_shadowControl_c::setSimple(cXyz* param_0, f32 param_1, f32 param_2, cX
return 1;
}
GXTexObj dDlst_shadowControl_c::mSimpleTexObj;
TGXTexObj dDlst_shadowControl_c::mSimpleTexObj;
void dDlst_shadowControl_c::setSimpleTex(ResTIMG const* i_timg) {
mDoLib_setResTimgObj(i_timg, &mSimpleTexObj, 0, NULL);
+3
View File
@@ -251,6 +251,9 @@ static void drawCapture(u8 alpha) {
GXSetAlphaUpdate(GX_FALSE);
j3dSys.drawInit();
#ifdef TARGET_PC
mDoGph_gInf_c::getFrameBufferTexObj()->reset();
#endif
GXInitTexObj(mDoGph_gInf_c::getFrameBufferTexObj(), mDoGph_gInf_c::getFrameBufferTex(), FB_WIDTH / 2, FB_HEIGHT / 2, (GXTexFmt)mDoGph_gInf_c::getFrameBufferTimg()->format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GXInitTexObjLOD(mDoGph_gInf_c::getFrameBufferTexObj(), GX_LINEAR, GX_LINEAR, 0.0f, 0.0f, 0.0f, GX_FALSE, GX_FALSE, GX_ANISO_1);
GXLoadTexObj(mDoGph_gInf_c::getFrameBufferTexObj(), GX_TEXMAP0);
+16 -6
View File
@@ -1537,6 +1537,12 @@ int dEvDtBase_c::init(char* i_data, int i_roomNo) {
setHeaderP((event_binary_data_header*)i_data);
#if TARGET_PC
bool needSwap = mHeaderP->unk[0] == 0;
JUT_ASSERT(1234, mHeaderP->unk[0] == 0 || mHeaderP->unk[0] == 1);
mHeaderP->unk[0] = 1;
#endif
if (getEventNum() > 0) {
setEventP((dEvDtEvent_c*)(i_data + getEventTop()));
}
@@ -1556,9 +1562,11 @@ int dEvDtBase_c::init(char* i_data, int i_roomNo) {
if (getFDataNum() > 0) {
#if TARGET_PC
auto data = (f32*)(i_data + getFDataTop());
int num = getFDataNum();
for (int i = 0; i < num; i++)
be_swap(data[i]);
if (needSwap) {
int num = getFDataNum();
for (int i = 0; i < num; i++)
be_swap(data[i]);
}
setFDataP(data);
#else
setFDataP((f32*)(i_data + getFDataTop()));
@@ -1569,9 +1577,11 @@ int dEvDtBase_c::init(char* i_data, int i_roomNo) {
#if TARGET_PC
// endian swap here
auto data = (int*)(i_data + getIDataTop());
int num = getIDataNum();
for (int i = 0; i < num; i++)
be_swap(data[i]);
if (needSwap) {
int num = getIDataNum();
for (int i = 0; i < num; i++)
be_swap(data[i]);
}
setIDataP(data);
#else
setIDataP((int*)(i_data + getIDataTop()));
+3 -1
View File
@@ -14,6 +14,8 @@
#include "JSystem/J2DGraph/J2DGrafContext.h"
#include <cstring>
#include "dusk/gx_helper.h"
class dGov_HIO_c : public mDoHIO_entry_c {
public:
dGov_HIO_c();
@@ -32,7 +34,7 @@ public:
static dGov_HIO_c l_HIO;
void dDlst_Gameover_CAPTURE_c::draw() {
GXTexObj tex_obj;
TGXTexObj tex_obj;
Mtx44 m;
GXSetTexCopySrc(0, 0, FB_WIDTH, FB_HEIGHT);
+3
View File
@@ -198,6 +198,9 @@ void dHomeButton_c::drawCapture(u8 param_0, void (*param_1)(J2DOrthoGraph&, void
sp30.setPort();
dComIfGp_setCurrentGrafPort(&sp30);
#ifdef TARGET_PC
mDoGph_gInf_c::m_fullFrameBufferTexObj.reset();
#endif
mDoLib_setResTimgObj(mDoGph_gInf_c::m_fullFrameBufferTimg,
&mDoGph_gInf_c::m_fullFrameBufferTexObj, 0, NULL);
+1 -1
View File
@@ -18,7 +18,7 @@ int dkWmark_c::m_nowID;
int dkWmark_c::create() {
static cXyz wolfFootScale(1.1f, 1.0f, 0.6f);
JKR_NEW_ARGS (this) dkWmark_c();
new (this) dkWmark_c;
field_0x48a = this->parameters >> 0x10;
this->parameters &= 0xFFFF;
+34 -15
View File
@@ -71,7 +71,10 @@ void dKy_set_eyevect_calc2(camera_class* i_camera, Vec* o_out, f32 param_2, f32
}
}
static void dKyr_set_btitex_common(GXTexObj* i_obj, ResTIMG* i_img, GXTexMapID i_mapID) {
static void dKyr_set_btitex_common(TGXTexObj* i_obj, ResTIMG* i_img, GXTexMapID i_mapID) {
#ifdef TARGET_PC
i_obj->reset();
#endif
GXInitTexObj(i_obj, (&i_img->format + i_img->imageOffset), i_img->width, i_img->height,
(GXTexFmt)i_img->format, (GXTexWrapMode)i_img->wrapS, (GXTexWrapMode)i_img->wrapT,
(GXBool)(i_img->mipmapCount > 1));
@@ -84,7 +87,7 @@ static void dKyr_set_btitex_common(GXTexObj* i_obj, ResTIMG* i_img, GXTexMapID i
GXLoadTexObj(i_obj, i_mapID);
}
static void dKyr_set_btitex(GXTexObj* i_obj, ResTIMG* i_img) {
static void dKyr_set_btitex(TGXTexObj* i_obj, ResTIMG* i_img) {
dKyr_set_btitex_common(i_obj, i_img, GX_TEXMAP0);
}
@@ -2116,7 +2119,7 @@ static void dKyr_draw_rev_moon(Mtx drawMtx, u8** tex) {
return;
}
GXTexObj texobj;
TGXTexObj texobj;
dKyr_set_btitex_common(&texobj, (ResTIMG*)tex[0], GX_TEXMAP0);
dKyr_set_btitex_common(&texobj, (ResTIMG*)tex[1], GX_TEXMAP1);
dKyr_set_btitex_common(&texobj, (ResTIMG*)tex[texidx + 2], GX_TEXMAP2);
@@ -2464,7 +2467,7 @@ void dKyr_drawSun(Mtx drawMtx, cXyz* ppos, GXColor& unused, u8** tex) {
return;
}
GXTexObj texobj;
TGXTexObj texobj;
dKyr_set_btitex_common(&texobj, (ResTIMG*)tex[0], GX_TEXMAP0);
dKyr_set_btitex_common(&texobj, (ResTIMG*)tex[1], GX_TEXMAP1);
dKyr_set_btitex_common(&texobj, (ResTIMG*)tex[texidx + 2], GX_TEXMAP2);
@@ -2724,7 +2727,7 @@ void dKyr_drawLenzflare(Mtx drawMtx, cXyz* ppos, GXColor& param_2, u8** tex) {
j3dSys.reinitGX();
GXTexObj texobj;
TGXTexObj texobj;
dKyr_set_btitex(&texobj, (ResTIMG*)tex[0]);
GXSetNumChans(0);
GXSetTevColor(GX_TEVREG0, color_reg0);
@@ -3125,7 +3128,7 @@ void dKyr_drawRain(Mtx drawMtx, u8** tex) {
return;
}
GXTexObj texobj;
TGXTexObj texobj;
dKyr_set_btitex(&texobj, (ResTIMG*)tex[0]);
GXSetNumChans(0);
GXSetTevColor(GX_TEVREG0, color_reg0);
@@ -3290,7 +3293,7 @@ void dKyr_drawSibuki(Mtx drawMtx, u8** tex) {
color.b = 0xC8;
color.a = rain_packet->mSibukiAlpha * alphaFade;
GXTexObj texobj;
TGXTexObj texobj;
dKyr_set_btitex(&texobj, (ResTIMG*)tex[1]);
GXSetNumChans(0);
GXSetTevColor(GX_TEVREG0, color);
@@ -3378,7 +3381,7 @@ void dKyr_drawHousi(Mtx drawMtx, u8** tex) {
Mtx camMtx;
Mtx rotMtx;
cXyz pos[4];
GXTexObj spDC;
TGXTexObj spDC;
cXyz spD0;
Vec spC4;
Vec spB8;
@@ -3795,7 +3798,7 @@ void dKyr_drawSnow(Mtx drawMtx, u8** tex) {
}
if (tex[0] != NULL) {
GXTexObj spA0;
TGXTexObj spA0;
dKyr_set_btitex(&spA0, (ResTIMG*)tex[0]);
GXSetNumChans(0);
GXSetTevColor(GX_TEVREG0, color_reg0);
@@ -4334,7 +4337,7 @@ void drawCloudShadow(Mtx drawMtx, u8** tex) {
GXSetClipMode(GX_CLIP_DISABLE);
GXTexObj texobj, fb_texobj;
TGXTexObj texobj, fb_texobj;
if (g_env_light.mMoyaMode < 50) {
dKy_ParticleColor_get_bg(&camera->view.lookat.eye, NULL, &sp48, &sp44, &sp40, &sp3C, 0.0f);
f32 temp_f30 = 0.4f;
@@ -4539,7 +4542,7 @@ void drawVrkumo(Mtx drawMtx, GXColor& color, u8** tex) {
Mtx camMtx;
Mtx rotMtx;
GXTexObj texobj;
TGXTexObj texobj;
cXyz proj;
f32 rot;
@@ -5370,7 +5373,7 @@ void dKyr_odour_draw(Mtx drawMtx, u8** tex) {
break;
}
GXTexObj texobj, fb_texobj;
TGXTexObj texobj, fb_texobj;
dKyr_set_btitex_common(&texobj, (ResTIMG*)tex[0], GX_TEXMAP1);
ResTIMG* fb_timg = mDoGph_gInf_c::getFrameBufferTimg();
@@ -5764,7 +5767,7 @@ void dKyr_mud_draw(Mtx drawMtx, u8** tex) {
if (g_env_light.camera_water_in_status == 0) {
for (int i = 0; i < 1; i++) {
GXTexObj texobj;
TGXTexObj texobj;
dKyr_set_btitex(&texobj, (ResTIMG*)tex[0]);
GXSetNumChans(0);
@@ -5924,7 +5927,7 @@ static void dKyr_evil_draw2(Mtx drawMtx, u8** tex) {
color_reg0.b = 0x87;
color_reg0.a = 0xFF;
GXTexObj texobj;
TGXTexObj texobj;
dKyr_set_btitex(&texobj, (ResTIMG*)tex[1]);
rot += 0.7f;
@@ -5980,11 +5983,19 @@ static void dKyr_evil_draw2(Mtx drawMtx, u8** tex) {
mDoLib_project(&sp7C, &proj);
#if TARGET_PC
if (!(proj.x > -sp34.x) || !(proj.x < (dComIfGd_getViewport()->width + sp34.x)) ||
!(proj.y > -sp34.y) || !(proj.y < (dComIfGd_getViewport()->height + sp34.z)))
{
continue;
}
#else
if (!(proj.x > -sp34.x) || !(proj.x < (FB_WIDTH + sp34.x)) ||
!(proj.y > -sp34.y) || !(proj.y < (458.0f + sp34.z)))
{
continue;
}
#endif
}
f32 sp40;
@@ -6147,7 +6158,7 @@ void dKyr_evil_draw(Mtx drawMtx, u8** tex) {
color_reg1.b = 10;
color_reg1.a = 255;
GXTexObj texobj;
TGXTexObj texobj;
dKyr_set_btitex(&texobj, (ResTIMG*)tex[0]);
rot += 1.0f;
@@ -6205,11 +6216,19 @@ void dKyr_evil_draw(Mtx drawMtx, u8** tex) {
mDoLib_project(&spA4, &proj);
#if TARGET_PC
if (!(proj.x > -sp44.x) || !(proj.x < (dComIfGd_getViewport()->width + sp44.x)) ||
!(proj.y > -sp44.y) || !(proj.y < (dComIfGd_getViewport()->height + sp44.z)))
{
continue;
}
#else
if (!(proj.x > -sp44.x) || !(proj.x < (FB_WIDTH + sp44.x)) ||
!(proj.y > -sp44.y) || !(proj.y < (458.0f + sp44.z)))
{
continue;
}
#endif
}
f32 sp5C;
+2
View File
@@ -341,6 +341,7 @@ inline u8 twoValueLineInterpolation(u8 param_0, u8 param_1, f32 param_2) {
}
void renderingAmap_c::draw() {
#if REQUIRES_GX_LINES
f32 tmp = ((f32)(g_Counter.mCounter0 % dMap_HIO_prm_res_dst_s::m_res->field_0x1aa) /
(f32)dMap_HIO_prm_res_dst_s::m_res->field_0x1aa);
tmp = tmp;
@@ -376,6 +377,7 @@ void renderingAmap_c::draw() {
setAmapPaletteColor(0x2E, temp_r31, temp_r30, temp_r29, temp_r28);
renderingDAmap_c::draw();
#endif
}
int renderingAmap_c::getDispType() const {
+5 -1
View File
@@ -20,7 +20,7 @@ void dMpath_n::dTexObjAggregate_c::create() {
};
for (int lp1 = 0; lp1 < 7; lp1++) {
mp_texObj[lp1] = JKR_NEW GXTexObj();
mp_texObj[lp1] = JKR_NEW TGXTexObj();
JUT_ASSERT(70, mp_texObj[lp1] != NULL);
ResTIMG* image = (ResTIMG*)dComIfG_getObjectRes("Always", data[lp1]);
JUT_ASSERT(72, image != NULL);
@@ -346,11 +346,13 @@ void dRenderingMap_c::makeResTIMG(ResTIMG* p_image, u16 width, u16 height, u8* p
void dRenderingMap_c::renderingMap() {
preRenderingMap();
if (isDrawPath()) {
#if REQUIRES_GX_LINES
preDrawPath();
beforeDrawPath();
drawPath();
afterDrawPath();
postDrawPath();
#endif
}
postRenderingMap();
}
@@ -471,6 +473,7 @@ void dRenderingFDAmap_c::renderingDecoration(dDrawPath_c::line_class const* p_li
GXSetTevColor(GX_TEVREG1, lineColor);
for (int i = 0; i < data_num; i++) {
#if REQUIRES_GX_LINES
#ifndef HYRULE_FIELD_SPEEDHACK
if (i < data_num - 1) {
GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, GX_CC_C0);
@@ -490,6 +493,7 @@ void dRenderingFDAmap_c::renderingDecoration(dDrawPath_c::line_class const* p_li
GXSetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV);
GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_TEXA);
GXSetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV);
#endif
#endif
GXBegin(GX_POINTS, GX_VTXFMT0, 1);
GXPosition1x16(data_p[0]);
+5
View File
@@ -2553,7 +2553,12 @@ u8 dMenu_Collect3D_c::getMaskMdlVisible() {
f32 dMenu_Collect3D_c::mViewOffsetY = -100.0f;
void dMenu_Collect3D_c::setupItem3D(Mtx param_0) {
#if TARGET_PC
f32 scaleFactor = mDoGph_gInf_c::getWidth() / FB_WIDTH; // TODO: get display pixel density from aurora
GXSetViewport(0.0f, mViewOffsetY * scaleFactor, mDoGph_gInf_c::getWidth(), mDoGph_gInf_c::getHeight(), 0.0f, 1.0f);
#else
GXSetViewport(0.0f, mViewOffsetY, FB_WIDTH, FB_HEIGHT, 0.0f, 1.0f);
#endif
mViewOffsetY = -100.0f;
Mtx44 projection;
C_MTXPerspective(projection, 45.0f, mDoGph_gInf_c::getAspect(), 1.0f, 100000.0f);
+4
View File
@@ -1262,8 +1262,10 @@ void dMenu_Ring_c::drawItem() {
(g_ringHIO.mItemAlphaMin + fVar16 * (g_ringHIO.mItemAlphaMax - g_ringHIO.mItemAlphaMin));
for (int i = 0; i < mItemsTotal; i++) {
if (i != mCurrentSlot || (mStatus != STATUS_WAIT && mStatus != STATUS_EXPLAIN && mStatus != STATUS_EXPLAIN_FORCE)) {
#if REQUIRES_GX_LINES
J2DDrawFrame(mItemSlotPosX[i] - 24.0f + mCenterPosX, mItemSlotPosY[i] - 24.0f + mCenterPosY,
48.0f, 48.0f, g_ringHIO.mItemFrame[g_ringHIO.UNSELECT_FRAME], 6);
#endif
f32 fVar17 = 1.0f;
if (i != mCurrentSlot) {
fVar17 = ringAlpha / 255.0f;
@@ -1306,8 +1308,10 @@ void dMenu_Ring_c::drawItem() {
void dMenu_Ring_c::drawItem2() {
s32 idx = mCurrentSlot;
if (mStatus == STATUS_WAIT || mStatus == STATUS_EXPLAIN || mStatus == STATUS_EXPLAIN_FORCE) {
#if REQUIRES_GX_LINES
J2DDrawFrame(mItemSlotPosX[idx] - 24.0f + mCenterPosX, mItemSlotPosY[idx] - 24.0f + mCenterPosY,
48.0f, 48.0f, g_ringHIO.mItemFrame[g_ringHIO.SELECT_FRAME], 6);
#endif
for (int i = 0; i < 3; i++) {
if (mpItemTex[idx][i] != NULL) {
+1 -1
View File
@@ -37,7 +37,7 @@ public:
GXCopyTex(mDoGph_gInf_c::getFrameBufferTex(), GX_FALSE);
GXPixModeSync();
} else {
GXTexObj tex;
TGXTexObj tex;
GXInitTexObj(&tex, mDoGph_gInf_c::getFrameBufferTex(), FB_WIDTH / 2, FB_HEIGHT / 2,
(GXTexFmt)mDoGph_gInf_c::getFrameBufferTimg()->format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GXInitTexObjLOD(&tex, GX_LINEAR, GX_LINEAR, 0.0f, 0.0f, 0.0f, GX_FALSE, GX_FALSE, GX_ANISO_1);
+3 -1
View File
@@ -26,12 +26,14 @@
#include "dusk/memory.h"
#include "dusk/memory.h"
int dMeter2_c::_create() {
stage_stag_info_class* stag_info = dComIfGp_getStageStagInfo();
if (dStage_stagInfo_GetUpButton(stag_info) == 1) {
mpHeap = fopMsgM_createExpHeap(HEAP_SIZE(0x5A400, 0xA0000), NULL);
} else {
mpHeap = fopMsgM_createExpHeap(HEAP_SIZE(0x60800, 0xA0000), NULL);
mpHeap = fopMsgM_createExpHeap(HEAP_SIZE(0x60800, 0xC1000), NULL);
}
JKRHEAP_NAME(mpHeap, "dMeter2_c");
+21 -21
View File
@@ -1051,7 +1051,7 @@ bool jmessage_tMeasureProcessor::do_tag(u32 i_tag, void const* i_data, u32 i_siz
case MSGTAG_COLOR:
return true;
case MSGTAG_SCALE: {
u16 scale = *(u16*)i_data;
u16 scale = *(BE(u16)*)i_data;
pReference->setLineScale(mTotalLineCnt, scale);
do_scale(scale / 100.0f);
return true;
@@ -1102,13 +1102,13 @@ bool jmessage_tMeasureProcessor::do_tag(u32 i_tag, void const* i_data, u32 i_siz
}
case MSGTAG_UNK_3:
case MSGTAG_AUTOBOX:
if (*(u16*)i_data != 0) {
if (*(BE(u16)*)i_data != 0) {
dMsgObject_c* objectPtr = pReference->mpObjectPtr; // fakematch, should be getObjectPtr
objectPtr->onAutoMessageFlag();
}
return true;
case MSGTAG_DEMOBOX:
pReference->setDemoFrame(*(u32*)i_data);
pReference->setDemoFrame(*(BE(u32)*)i_data);
return true;
case MSGTAG_PLAYER_NAME: {
if (field_0x49 != 0) {
@@ -1414,7 +1414,7 @@ bool jmessage_tMeasureProcessor::do_tag(u32 i_tag, void const* i_data, u32 i_siz
dMsgUnit_setTag(1, (s32)dComIfGp_getMessageCountNumber(), buffer);
break;
case MSGTAG_FUNDRAISE_REMAIN: {
s16 fund_raise_val = *(u32*)i_data;
s16 fund_raise_val = *(BE(u32)*)i_data;
dMsgObject_c* objectPtr = pReference->getObjectPtr();
objectPtr->setFundRaisingValue(fund_raise_val);
@@ -1555,7 +1555,7 @@ bool jmessage_tMeasureProcessor::do_tag(u32 i_tag, void const* i_data, u32 i_siz
do_space(i_tag);
return true;
case MSGTAG_WII_MSGID_OVERRIDE:
pReference->setRevoMessageID(*(u32*)i_data);
pReference->setRevoMessageID(*(BE(u32)*)i_data);
return true;
}
}
@@ -2169,7 +2169,7 @@ bool jmessage_tSequenceProcessor::do_tag(u32 i_tag, void const* i_data, u32 i_si
pReference->setNowColorType(*(u8*)i_data & 0xFF);
return true;
case MSGTAG_SCALE:
pReference->setNowTagScale(*(u16*)i_data & 0xFFFF);
pReference->setNowTagScale(*(BE(u16)*)i_data & 0xFFFF);
return true;
case MSGTAG_RUBY:
case 0xFFFF02:
@@ -2220,7 +2220,7 @@ bool jmessage_tSequenceProcessor::do_tag(u32 i_tag, void const* i_data, u32 i_si
return true;
case MSGTAG_UNK_3:
case MSGTAG_AUTOBOX:
pReference->setSendTimer(*(u16*)i_data);
pReference->setSendTimer(*(BE(u16)*)i_data);
if (pReference->getSendTimer() == 0) {
pReference->setSendFlag(3);
} else {
@@ -2228,24 +2228,24 @@ bool jmessage_tSequenceProcessor::do_tag(u32 i_tag, void const* i_data, u32 i_si
}
return true;
case MSGTAG_BOXATMOST:
pReference->setSendTimer(*(u16*)i_data);
pReference->setSendTimer(*(BE(u16)*)i_data);
pReference->setSendFlag(2);
return true;
case MSGTAG_BOXATLEAST:
dMeter2Info_setMsgKeyWaitTimer(*(u16*)i_data);
pReference->setSendTimer(*(u16*)i_data);
dMeter2Info_setMsgKeyWaitTimer(*(BE(u16)*)i_data);
pReference->setSendTimer(*(BE(u16)*)i_data);
pReference->setSendFlag(6);
return true;
case MSGTAG_DEMOBOX:
pReference->setDemoFrame(*(u32*)i_data);
pReference->setDemoFrame(*(BE(u32)*)i_data);
pReference->setSendFlag(4);
return true;
case MSGTAG_UNK_6:
field_0xa8 = *(u16*)i_data;
field_0xa8 = *(BE(u16)*)i_data;
field_0xa4 = field_0xa8;
return true;
case MSGTAG_PAUSE:
field_0xa4 = *(u16*)i_data;
field_0xa4 = *(BE(u16)*)i_data;
mMouthCheck = 0;
return true;
case MSGTAG_SELECT_2WAY:
@@ -2361,7 +2361,7 @@ bool jmessage_tSequenceProcessor::do_tag(u32 i_tag, void const* i_data, u32 i_si
pReference->resetInputFigure();
pReference->setSendFlag(5);
if (*(u32*)i_data == 1) {
if (*(BE(u32)*)i_data == 1) {
dComIfGs_onTmpBit(dSv_event_tmp_flag_c::tempBitLabels[80]);
}
return true;
@@ -2903,7 +2903,7 @@ bool jmessage_tRenderingProcessor::do_tag(u32 i_tag, void const* i_data, u32 i_s
do_color(*(u8*)i_data & 0xFF);
return 1;
case MSGTAG_SCALE:
field_0x13c = *(u16*)i_data & 0xFFFF;
field_0x13c = *(BE(u16)*)i_data & 0xFFFF;
do_scale(field_0x13c / 100.0f);
return 1;
case MSGTAG_RUBY:
@@ -2937,7 +2937,7 @@ bool jmessage_tRenderingProcessor::do_tag(u32 i_tag, void const* i_data, u32 i_s
stack_pushCurrent(pReference->getObjectPtr()->getLetterName());
return 1;
case MSGTAG_LINE_DOWN:
do_linedown(*(u16*)i_data);
do_linedown(*(BE(u16)*)i_data);
return 1;
case MSGTAG_CURRENT_LETTER_PAGE:
case MSGTAG_MAX_LETTER_PAGE:
@@ -4178,7 +4178,7 @@ bool jmessage_string_tMeasureProcessor::do_tag(u32 i_tag, void const* i_data, u3
dMsgUnit_setTag(1, (s32)dComIfGp_getMessageCountNumber(), buffer);
break;
case MSGTAG_FUNDRAISE_REMAIN: {
s16 uVar9 = *(int*)i_data;
s16 uVar9 = *(BE(int)*)i_data;
dMsgObject_getMsgObjectClass()->setFundRaisingValue(uVar9);
dMsgUnit_setTag(10, uVar9 - dMsgObject_getFundRaising(), buffer);
break;
@@ -4384,7 +4384,7 @@ bool jmessage_string_tSequenceProcessor::do_tag(u32 i_tag, void const* i_data, u
case MSGTAG_GROUP(0):
switch(i_tag) {
case MSGTAG_BOXATLEAST:
dMeter2Info_setMsgKeyWaitTimer(*(u16*)i_data);
dMeter2Info_setMsgKeyWaitTimer(*(BE(u16)*)i_data);
break;
}
break;
@@ -4537,7 +4537,7 @@ bool jmessage_string_tRenderingProcessor::do_tag(u32 i_tag, void const* i_data,
do_color(*(u8*)i_data & 0xFF);
break;
case MSGTAG_SCALE:
do_scale(*(u16*)i_data / 100.0f);
do_scale(*(BE(u16)*)i_data / 100.0f);
break;
case MSGTAG_RUBY:
case 0xFFFF02:
@@ -4572,7 +4572,7 @@ bool jmessage_string_tRenderingProcessor::do_tag(u32 i_tag, void const* i_data,
push_word(dMsgObject_getMsgObjectClass()->getLetterName());
break;
case MSGTAG_LINE_DOWN:
do_linedown(*(u16*)i_data);
do_linedown(*(BE(u16)*)i_data);
break;
case MSGTAG_CURRENT_LETTER_PAGE: {
char buffer[4];
@@ -4788,7 +4788,7 @@ bool jmessage_string_tRenderingProcessor::do_tag(u32 i_tag, void const* i_data,
dMsgUnit_setTag(1, (s32)dComIfGp_getMessageCountNumber(), buffer);
break;
case MSGTAG_FUNDRAISE_REMAIN: {
s16 uVar9 = *(int*)i_data;
s16 uVar9 = *(BE(int)*)i_data;
dMsgObject_getMsgObjectClass()->setFundRaisingValue(uVar9);
dMsgUnit_setTag(10, uVar9 - dMsgObject_getFundRaising(), buffer);
break;
+16 -16
View File
@@ -49,8 +49,8 @@ void dMsgFlow_c::init(fopAc_ac_c* i_partner, int i_flowID, int param_2, fopAc_ac
labelInfoTBL = mLabelInfo_p + 0x10;
mFlowNodeTBL = (mesg_flow*)(mFlow_p + 0x10);
mFlowIdxTBL = (u16*)(mFlowNodeTBL + (*(u16*)(mFlow_p + 8)));
field_0x18 = mFlowIdxTBL + *(u16*)(mFlow_p + 8);
mFlowIdxTBL = (BE(u16)*)(mFlowNodeTBL + (*(BE(u16)*)(mFlow_p + 8)));
field_0x18 = mFlowIdxTBL + *(BE(u16)*)(mFlow_p + 8);
mFlow = prevFlowID;
@@ -322,8 +322,8 @@ void dMsgFlow_c::setInitValueGroupChange(int i_msgNo, fopAc_ac_c** i_talkPartner
labelInfoTBL = mLabelInfo_p + 0x10;
mFlowNodeTBL = (mesg_flow*)(mFlow_p + 0x10);
mFlowIdxTBL = (u16*)(mFlowNodeTBL + *(u16*)(mFlow_p + 8));
field_0x18 = mFlowIdxTBL + *(u16*)(mFlow_p + 8);
mFlowIdxTBL = (BE(u16)*)(mFlowNodeTBL + *(BE(u16)*)(mFlow_p + 8));
field_0x18 = mFlowIdxTBL + *(BE(u16)*)(mFlow_p + 8);
mFlow = var_r28;
setNodeIndex(getInitNodeIndex(mFlow), i_talkPartners);
}
@@ -337,7 +337,7 @@ u8* dMsgFlow_c::getMsgDataBlock(char const* block_tag) {
aMsgRes_p = dMsgObject_getMsgDtPtr();
JUT_ASSERT(742, NULL != aMsgRes_p);
u32 num = *(u32*)(aMsgRes_p + 0xC);
u32 num = *(BE(u32)*)(aMsgRes_p + 0xC);
aMsgRes_p += 0x20;
for (u32 i = 0; i < num; i++) {
@@ -348,7 +348,7 @@ u8* dMsgFlow_c::getMsgDataBlock(char const* block_tag) {
return aMsgRes_p;
}
aMsgRes_p += *(int*)(block_p + 4);
aMsgRes_p += *(BE(int)*)(block_p + 4);
}
return NULL;
@@ -361,9 +361,9 @@ u16 dMsgFlow_c::getInitNodeIndex(u16 param_1) {
JUT_ASSERT(777, NULL != mLabelInfo_p);
var_r30 = mLabelInfo_p + 0x10;
for (int i = 0; i < *(u16*)(mLabelInfo_p + 8); i++) {
if (*(u32*)var_r30 >> 16 == param_1) {
var_r27 = *(u16*)(var_r30 + 4);
for (int i = 0; i < *(BE(u16)*)(mLabelInfo_p + 8); i++) {
if (*(BE(u32)*)var_r30 >> 16 == param_1) {
var_r27 = *(BE(u16)*)(var_r30 + 4);
}
var_r30 += 0x8;
@@ -441,13 +441,13 @@ void dMsgFlow_c::setNodeIndex(u16 i_nodeIdx, fopAc_ac_c** i_talkPartners) {
int dMsgFlow_c::setSelectMsg(mesg_flow_node* i_flowNode_p, mesg_flow_node* param_2,
fopAc_ac_c* i_speaker_p) {
u16* inf_p = NULL;
BE(u16)* inf_p = NULL;
u16 temp_r25;
u16 msg_no;
mesg_flow_node* var_r29 = NULL;
inf_p = (u16*)getMsgDataBlock("INF1");
inf_p = (BE(u16)*)getMsgDataBlock("INF1");
var_r29 = param_2;
temp_r25 = ((inf_p + (var_r29->msg_index) * 10))[10];
@@ -491,13 +491,13 @@ int dMsgFlow_c::setSelectMsg(mesg_flow_node* i_flowNode_p, mesg_flow_node* param
}
int dMsgFlow_c::setNormalMsg(mesg_flow_node* i_flowNode_p, fopAc_ac_c* i_speaker_p) {
u16* inf_p = NULL;
BE(u16)* inf_p = NULL;
mesg_flow_node* var_r29 = NULL;
u16 msg_no;
var_r29 = i_flowNode_p;
inf_p = (u16*)getMsgDataBlock("INF1");
msg_no = ((inf_p + (var_r29->msg_index) * 10))[10];
inf_p = (BE(u16)*)getMsgDataBlock("INF1");
msg_no = (inf_p + (var_r29->msg_index) * 10)[10];
// "Message Set"
OS_REPORT("\x1B[44;37mメッセ−ジセット          \x1B[m|:");
@@ -727,8 +727,8 @@ int dMsgFlow_c::nodeProc(fopAc_ac_c* i_speaker_p, fopAc_ac_c** i_talkPartners) {
}
int dMsgFlow_c::getParam(u16* prm0, u16* prm1, u8* params) {
*prm0 = *(u16*)params;
*prm1 = *(u16*)(params + 2);
*prm0 = *(BE(u16)*)params;
*prm1 = *(BE(u16)*)(params + 2);
return *(int*)params;
}
+8
View File
@@ -12,8 +12,13 @@
#include "m_Do/m_Do_graphic.h"
void dOvlpFd2_dlst_c::draw() {
#if TARGET_PC
GXSetViewport(0.0f, 0.0f, mDoGph_gInf_c::getWidth(), mDoGph_gInf_c::getHeight(), 0.0f, 1.0f);
GXSetScissor(0, 0, mDoGph_gInf_c::getWidth(), mDoGph_gInf_c::getHeight());
#else
GXSetViewport(0.0f, 0.0f, FB_WIDTH, FB_HEIGHT, 0.0f, 1.0f);
GXSetScissor(0, 0, FB_WIDTH, FB_HEIGHT);
#endif
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGB, GX_RGBA4, 0);
GXClearVtxDesc();
GXSetVtxDesc(GX_VA_POS, GX_DIRECT);
@@ -49,6 +54,9 @@ void dOvlpFd2_dlst_c::draw() {
C_MTXPerspective(m, 60.0f, mDoGph_gInf_c::getWidthF() / mDoGph_gInf_c::getHeightF(), 100.0f,
100000.0f);
GXSetProjection(m, GX_PERSPECTIVE);
#ifdef TARGET_PC
mDoGph_gInf_c::getFrameBufferTexObj()->reset();
#endif
GXInitTexObj(mDoGph_gInf_c::getFrameBufferTexObj(), mDoGph_gInf_c::getFrameBufferTex(), FB_WIDTH / 2,
FB_HEIGHT / 2, GX_TF_RGBA8, GX_CLAMP, GX_CLAMP, GX_FALSE);
GXInitTexObjLOD(mDoGph_gInf_c::getFrameBufferTexObj(), GX_LINEAR, GX_LINEAR, 0.0f, 0.0f, 0.0f,

Some files were not shown because too many files have changed in this diff Show More