mirror of
https://github.com/zeldaret/tww.git
synced 2026-08-19 05:22:39 -04:00
misc work
This commit is contained in:
@@ -15,6 +15,12 @@
|
||||
#include "dolphin/os/OSCache.h"
|
||||
#include "dolphin/os/OSInterrupt.h"
|
||||
|
||||
namespace JASystem {
|
||||
namespace HardStream {
|
||||
void main();
|
||||
}
|
||||
};
|
||||
|
||||
/* 8027AE30-8027AE5C .text init__Q28JASystem6KernelFv */
|
||||
void JASystem::Kernel::init() {
|
||||
resetCallback();
|
||||
@@ -100,7 +106,7 @@ void JASystem::Kernel::updateDac() {
|
||||
if (!lastRspMadep && vframeWorkRunning == 0) {
|
||||
vframeWork();
|
||||
}
|
||||
//HardStream::main();
|
||||
HardStream::main();
|
||||
if (dacCallbackFunc) {
|
||||
dacCallbackFunc(lastRspMadep, gDacSize / 2);
|
||||
}
|
||||
|
||||
@@ -63,7 +63,6 @@ void JASystem::Calc::bcopyfast(const u32* src, u32* dest, u32 size) {
|
||||
|
||||
/* 8027AB68-8027AC68 .text bcopy__Q28JASystem4CalcFPCvPvUl */
|
||||
void JASystem::Calc::bcopy(const void* src, void* dest, u32 size) {
|
||||
/* Nonmatching */
|
||||
u32 *usrc;
|
||||
u32 *udest;
|
||||
|
||||
@@ -106,7 +105,6 @@ void JASystem::Calc::bcopy(const void* src, void* dest, u32 size) {
|
||||
|
||||
/* 8027AC68-8027AD38 .text bzerofast__Q28JASystem4CalcFPvUl */
|
||||
void JASystem::Calc::bzerofast(void* dest, u32 size) {
|
||||
/* Nonmatching */
|
||||
JUT_ASSERT(387, (reinterpret_cast<u32>(dest) & 0x03) == 0);
|
||||
JUT_ASSERT(388, (size & 0x0f) == 0);
|
||||
u32* udest = (u32*)dest;
|
||||
@@ -120,7 +118,6 @@ void JASystem::Calc::bzerofast(void* dest, u32 size) {
|
||||
|
||||
/* 8027AD38-8027AE30 .text bzero__Q28JASystem4CalcFPvUl */
|
||||
void JASystem::Calc::bzero(void* dest, u32 size) {
|
||||
/* Nonmatching */
|
||||
u32 *udest;
|
||||
u8 *bdest = (u8 *)dest;
|
||||
if ((size & 0x1f) == 0 && (reinterpret_cast<u32>(dest) & 0x1f) == 0) {
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
|
||||
/* 8028B3E8-8028B5A4 .text init__Q28JASystem8TChannelFv */
|
||||
void JASystem::TChannel::init() {
|
||||
/* Nonmatching */
|
||||
field_0x28 = 0;
|
||||
field_0x2c = 0;
|
||||
field_0x30 = 0;
|
||||
@@ -291,19 +290,17 @@ f32 JASystem::TChannel::calcPan(const Driver::PanMatrix_*, const Driver::PanMatr
|
||||
/* 8028CC90-8028CD90 .text updateJcToDSPInit__Q28JASystem8TChannelFv */
|
||||
void JASystem::TChannel::updateJcToDSPInit() {
|
||||
/* Nonmatching */
|
||||
JASystem::DSPInterface::DSPBuffer * pBuffer = field_0x20->field_0xc;
|
||||
if (pBuffer->field_0xb0[0] == 0xFFFF) {
|
||||
pBuffer->initAutoMixer();
|
||||
pBuffer->setMixerInitDelayMax(field_0x4->field_0x60);
|
||||
}
|
||||
}
|
||||
|
||||
/* 8028CD90-8028CEA8 .text updateAutoMixer__Q28JASystem8TChannelFffff */
|
||||
void JASystem::TChannel::updateAutoMixer(f32 param_1, f32 param_2, f32 param_3, f32 param_4) {
|
||||
/* Nonmatching */
|
||||
f32 f31 = 0.0f;
|
||||
if (param_1 > f31) {
|
||||
f31 = 1.0f;
|
||||
if (param_1 >= f31) {
|
||||
f31 = param_1;
|
||||
}
|
||||
}
|
||||
field_0x20->field_0xc->setAutoMixer(f31 * Driver::getAutoLevel(), param_2 * 127.5f, param_4 * 127.5f, param_3 * 127.5f, field_0xb0[1]);
|
||||
f32 level = param_1 <= 0.0f ? 0.0f : param_1 >= 1.0f ? 1.0f : param_1;
|
||||
field_0x20->field_0xc->setAutoMixer(level * Driver::getAutoLevel(), param_2 * 127.5f, param_4 * 127.5f, param_3 * 127.5f, field_0xb0[1]);
|
||||
}
|
||||
|
||||
/* 8028CEA8-8028D128 .text updateMixer__Q28JASystem8TChannelFffff */
|
||||
|
||||
@@ -69,14 +69,13 @@ void JASystem::TChannelMgr::stopAllRelease() {
|
||||
|
||||
/* 8028D558-8028D5D0 .text initAllocChannel__Q28JASystem11TChannelMgrFUl */
|
||||
void JASystem::TChannelMgr::initAllocChannel(u32 param_1) {
|
||||
/* Nonmatching */
|
||||
if (field_0x0) {
|
||||
OSReport("----- Warning JCSにボイスが %d 残っているのでグローバルに返却します\n", field_0x0);
|
||||
TGlobalChannel::releaseAll(this);
|
||||
}
|
||||
init();
|
||||
TGlobalChannel::alloc(this, param_1);
|
||||
field_0x70 = param_1 != 0;
|
||||
field_0x70 = (param_1 != 0) ? 1 : 0;
|
||||
}
|
||||
|
||||
/* 8028D5D0-8028D778 .text getLogicalChannel__Q28JASystem11TChannelMgrFUl */
|
||||
|
||||
@@ -513,13 +513,17 @@ void DspBoot(void (*param_1)(void*)) {
|
||||
}
|
||||
|
||||
/* 8028E960-8028EA48 .text DSPSendCommands2__FPUlUlPFUs_v */
|
||||
int DSPSendCommands2(u32* param_1, u32 param_2, void (*param_3)(u16)) {
|
||||
int DSPSendCommands2(u32* param_1, u32 param_2, void (*callBack)(u16)) {
|
||||
/* Nonmatching */
|
||||
while (Dsp_Running_Check() == 0);
|
||||
s32 startWorkStatus;
|
||||
BOOL interruptFlag;
|
||||
s32 i;
|
||||
|
||||
BOOL status = OSDisableInterrupts();
|
||||
while (Dsp_Running_Check() == 0) {};
|
||||
|
||||
interruptFlag = OSDisableInterrupts();
|
||||
if (DSPCheckMailToDSP()) {
|
||||
OSRestoreInterrupts(status);
|
||||
OSRestoreInterrupts(interruptFlag);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -527,21 +531,20 @@ int DSPSendCommands2(u32* param_1, u32 param_2, void (*param_3)(u16)) {
|
||||
DSPAssertInt();
|
||||
while(DSPCheckMailToDSP() != 0);
|
||||
|
||||
if (param_1 == 0) {
|
||||
if (param_2 == 0) {
|
||||
param_2 = 1;
|
||||
}
|
||||
|
||||
int startWorkStatus;
|
||||
if (param_3 != NULL) {
|
||||
startWorkStatus = DspStartWork(param_1[0], param_3);
|
||||
if (callBack != NULL) {
|
||||
startWorkStatus = DspStartWork(param_1[0], callBack);
|
||||
}
|
||||
|
||||
for (int i = 0; i < param_2; i++) {
|
||||
for (i = 0; i < param_2; i++) {
|
||||
DSPSendMailToDSP(param_1[i]);
|
||||
while (DSPCheckMailToDSP() != 0);
|
||||
}
|
||||
|
||||
OSRestoreInterrupts(status);
|
||||
OSRestoreInterrupts(interruptFlag);
|
||||
return startWorkStatus;
|
||||
}
|
||||
|
||||
@@ -555,7 +558,6 @@ static TaskWorkStruct taskwork[16];
|
||||
|
||||
/* 8028EA60-8028EA8C .text DspInitWork__Fv */
|
||||
void DspInitWork() {
|
||||
/* Nonmatching */
|
||||
for (int i = 0; i < 16; i++) {
|
||||
taskwork[i].field_0x4 = NULL;
|
||||
}
|
||||
|
||||
@@ -99,7 +99,6 @@ void JPABaseEmitter::calcEmitterInfo() {
|
||||
|
||||
/* 8025D294-8025D3C0 .text calc__14JPABaseEmitterFv */
|
||||
void JPABaseEmitter::calc() {
|
||||
/* Nonmatching */
|
||||
emtrInfo.mVolumeEmitCount = 0;
|
||||
if (!checkStatus(JPAEmtrStts_StopCalc)) {
|
||||
calcKey();
|
||||
|
||||
@@ -4,14 +4,144 @@
|
||||
//
|
||||
|
||||
#include "JSystem/JParticle/JPAEmitterLoader.h"
|
||||
#include "dolphin/types.h"
|
||||
#include "JSystem/JParticle/JPAEmitter.h"
|
||||
#include "JSystem/JParticle/JPAResourceManager.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
|
||||
#include "JSystem/JParticle/JPADynamicsBlock.h"
|
||||
#include "JSystem/JParticle/JPABaseShape.h"
|
||||
#include "JSystem/JParticle/JPAExtraShape.h"
|
||||
#include "JSystem/JParticle/JPASweepShape.h"
|
||||
#include "JSystem/JParticle/JPAExTexShape.h"
|
||||
#include "JSystem/JParticle/JPAKeyBlock.h"
|
||||
#include "JSystem/JParticle/JPAFieldBlock.h"
|
||||
|
||||
class JPAEmitterArchiveLoader_v10 {
|
||||
public:
|
||||
void load();
|
||||
|
||||
public:
|
||||
/* 0x00 */ JKRHeap* pHeap;
|
||||
/* 0x04 */ const u8* pData;
|
||||
/* 0x08 */ JPAEmitterResource* mpEmtrRes;
|
||||
/* 0x0C */ JPATextureResource* mpTexRes;
|
||||
};
|
||||
|
||||
/* 802590B4-8025917C .text load__31JPAEmitterArchiveLoaderDataBaseFPCUcP7JKRHeapPP18JPAEmitterResourcePP18JPATextureResource */
|
||||
void JPAEmitterArchiveLoaderDataBase::load(const unsigned char*, JKRHeap*, JPAEmitterResource**, JPATextureResource**) {
|
||||
/* Nonmatching */
|
||||
void JPAEmitterArchiveLoaderDataBase::load(const u8* data, JKRHeap* heap, JPAEmitterResource** dstEmtrRes, JPATextureResource** dstTexRes) {
|
||||
u32 magic = ((const u32*)data)[0];
|
||||
|
||||
if (magic == 'JPAC') {
|
||||
u32 version = ((const u32*)data)[1];
|
||||
if (version == '1-00') {
|
||||
JPAEmitterArchiveLoader_v10 loader;
|
||||
loader.pHeap = heap;
|
||||
loader.pData = data;
|
||||
loader.mpEmtrRes = NULL;
|
||||
loader.mpTexRes = NULL;
|
||||
loader.load();
|
||||
*dstEmtrRes = loader.mpEmtrRes;
|
||||
*dstTexRes = loader.mpTexRes;
|
||||
} else {
|
||||
JUT_WARN(201, "%s", "This is WRONG Version File\n");
|
||||
}
|
||||
} else {
|
||||
JUT_WARN(202, "%s", "This is WRONG File\n");
|
||||
}
|
||||
}
|
||||
|
||||
struct JPAEmitterArchiveData_v10 {
|
||||
/* 0x00 */ u32 magic;
|
||||
/* 0x04 */ u32 size;
|
||||
/* 0x08 */ u16 emtrResNum;
|
||||
/* 0x0A */ u16 texResNum;
|
||||
};
|
||||
|
||||
/* 8025917C-8025991C .text load__27JPAEmitterArchiveLoader_v10Fv */
|
||||
void JPAEmitterArchiveLoader_v10::load() {
|
||||
/* Nonmatching */
|
||||
const JPAEmitterArchiveData_v10* header = (const JPAEmitterArchiveData_v10*)pData;
|
||||
mpEmtrRes = new(pHeap, 0) JPAEmitterResource(header->emtrResNum, pHeap);
|
||||
mpTexRes = new(pHeap, 0) JPATextureResource(header->texResNum, pHeap);
|
||||
|
||||
u32 offs = 0x20;
|
||||
for (u32 i = 0; i < header->emtrResNum; i++) {
|
||||
JPAEmitterData* pEmtrRes = new(pHeap, 0) JPAEmitterData();
|
||||
JUT_ASSERT(234, pEmtrRes);
|
||||
|
||||
JPADataBlockLinkInfo* pLinkInfo = new(pHeap, 0) JPADataBlockLinkInfo();
|
||||
JUT_ASSERT(238, pLinkInfo);
|
||||
|
||||
pEmtrRes->infoNum = 1;
|
||||
pEmtrRes->pLinkInfoArray = new(pHeap, 0) JPADataBlockLinkInfo*[pEmtrRes->infoNum];
|
||||
JUT_ASSERT(243, pEmtrRes->pLinkInfoArray);
|
||||
pEmtrRes->pLinkInfoArray[0] = pLinkInfo;
|
||||
|
||||
pLinkInfo->keyNum = pData[offs + 0x14];
|
||||
pLinkInfo->keyBlocks = (JPAKeyBlock**) (pLinkInfo->keyNum != 0 ? new(pHeap, 0) JPAKeyBlockArc*[pLinkInfo->keyNum] : NULL);
|
||||
JUT_ASSERT(250, pLinkInfo->keyBlocks || pLinkInfo->keyNum == 0);
|
||||
|
||||
pLinkInfo->fldNum = pData[offs + 0x15];
|
||||
pLinkInfo->fldBlocks = (JPAFieldBlock**) (pLinkInfo->fldNum != 0 ? new(pHeap, 0) JPAFieldBlockArc*[pLinkInfo->fldNum] : NULL);
|
||||
JUT_ASSERT(256, pLinkInfo->fldBlocks || pLinkInfo->fldNum == 0);
|
||||
|
||||
pLinkInfo->mTextureNum = pData[offs + 0x16];
|
||||
pLinkInfo->texDataBase = NULL;
|
||||
|
||||
u32 fld_cntr = 0;
|
||||
u32 key_cntr = 0;
|
||||
u32 blockOffs = offs + 0x20;
|
||||
for (u32 j = 0; j < *((u32*)(pData + offs + 0x0C)); j++) {
|
||||
const u8* block = (const u8*)(pData + blockOffs);
|
||||
u32 size = ((u32*)block)[1];
|
||||
switch (((u32*)block)[0]) {
|
||||
case 'FLD1':
|
||||
pLinkInfo->fldBlocks[fld_cntr] = (JPAFieldBlock*) new(pHeap, 0) JPAFieldBlockArc(pData + blockOffs);
|
||||
JUT_ASSERT(274, pLinkInfo->fldBlocks[fld_cntr]);
|
||||
fld_cntr++;
|
||||
break;
|
||||
case 'KFA1':
|
||||
pLinkInfo->keyBlocks[key_cntr] = (JPAKeyBlock*) new(pHeap, 0) JPAKeyBlockArc(pData + blockOffs);
|
||||
JUT_ASSERT(278, pLinkInfo->keyBlocks[key_cntr]);
|
||||
key_cntr++;
|
||||
break;
|
||||
case 'BEM1':
|
||||
pLinkInfo->dynBlock = (JPADynamicsBlock*) new(pHeap, 0) JPADynamicsBlockArc(pData + blockOffs);
|
||||
JUT_ASSERT(284, pLinkInfo->dynBlock);
|
||||
break;
|
||||
case 'BSP1':
|
||||
pLinkInfo->bspBlock = (JPABaseShape*) new(pHeap, 0) JPABaseShapeArc(pData + blockOffs, pHeap);
|
||||
JUT_ASSERT(288, pLinkInfo->bspBlock);
|
||||
break;
|
||||
case 'ESP1':
|
||||
pLinkInfo->espBlock = (JPAExtraShape*) new(pHeap, 0) JPAExtraShapeArc(pData + blockOffs);
|
||||
JUT_ASSERT(292, pLinkInfo->espBlock);
|
||||
break;
|
||||
case 'SSP1':
|
||||
pLinkInfo->sspBlock = (JPASweepShape*) new(pHeap, 0) JPASweepShapeArc(pData + blockOffs);
|
||||
JUT_ASSERT(296, pLinkInfo->sspBlock);
|
||||
break;
|
||||
case 'ETX1':
|
||||
pLinkInfo->etxBlock = (JPAExTexShape*) new(pHeap, 0) JPAExTexShapeArc(pData + blockOffs);
|
||||
JUT_ASSERT(300, pLinkInfo->etxBlock);
|
||||
break;
|
||||
case 'TDB1':
|
||||
pLinkInfo->texDataBase = (u32*)(block + 0x0c);
|
||||
break;
|
||||
}
|
||||
|
||||
blockOffs += size;
|
||||
}
|
||||
|
||||
mpEmtrRes->registration(pEmtrRes, *(u16*)(pData + 0x18));
|
||||
offs = blockOffs;
|
||||
}
|
||||
|
||||
for (u32 i = 0; i < header->texResNum; i++) {
|
||||
u32 size = *(u32*)(pData + offs + 0x04);
|
||||
JPATextureArc * pTex = new(pHeap, 0) JPATextureArc(pData + offs);
|
||||
JUT_ASSERT(319, pTex);
|
||||
mpTexRes->registration(pTex);
|
||||
offs += size;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,44 +4,88 @@
|
||||
//
|
||||
|
||||
#include "JSystem/JParticle/JPAResourceManager.h"
|
||||
#include "dolphin/types.h"
|
||||
#include "JSystem/JParticle/JPAEmitterLoader.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "JSystem/JUtility/JUTTexture.h"
|
||||
#include "MSL_C/string.h"
|
||||
|
||||
/* 80258CAC-80258D54 .text __ct__18JPATextureResourceFUlP7JKRHeap */
|
||||
JPATextureResource::JPATextureResource(unsigned long, JKRHeap*) {
|
||||
/* Nonmatching */
|
||||
JPATextureResource::JPATextureResource(u32 num, JKRHeap* heap) {
|
||||
registNum = 0;
|
||||
maxNum = num;
|
||||
pTexResArray = new(heap, 0) JPATexture*[maxNum];
|
||||
JUT_ASSERT(24, pTexResArray);
|
||||
defaultTex.initialize(heap);
|
||||
}
|
||||
|
||||
/* 80258D54-80258DE4 .text registration__18JPATextureResourceFP10JPATexture */
|
||||
void JPATextureResource::registration(JPATexture*) {
|
||||
/* Nonmatching */
|
||||
void JPATextureResource::registration(JPATexture* res) {
|
||||
JUT_ASSERT(76, registNum < maxNum);
|
||||
pTexResArray[registNum] = res;
|
||||
registNum++;
|
||||
}
|
||||
|
||||
static void dummy() {
|
||||
OSReport("pTexResArray[registNum]");
|
||||
}
|
||||
|
||||
/* 80258DE4-80258E70 .text __ct__18JPAEmitterResourceFUlP7JKRHeap */
|
||||
JPAEmitterResource::JPAEmitterResource(unsigned long, JKRHeap*) {
|
||||
/* Nonmatching */
|
||||
JPAEmitterResource::JPAEmitterResource(u32 num, JKRHeap* heap) {
|
||||
registNum = 0;
|
||||
maxNum = num;
|
||||
pEmtrResArray = new(heap, 0) JPAEmitterData*[maxNum];
|
||||
JUT_ASSERT(93, pEmtrResArray);
|
||||
}
|
||||
|
||||
/* 80258E70-80258F18 .text registration__18JPAEmitterResourceFP14JPAEmitterDataUs */
|
||||
void JPAEmitterResource::registration(JPAEmitterData*, unsigned short) {
|
||||
/* Nonmatching */
|
||||
void JPAEmitterResource::registration(JPAEmitterData* res, u16 userIndex) {
|
||||
JUT_ASSERT(107, registNum < maxNum);
|
||||
if (registNum < maxNum) {
|
||||
res->userIndex = userIndex;
|
||||
pEmtrResArray[registNum] = res;
|
||||
}
|
||||
registNum++;
|
||||
}
|
||||
|
||||
/* 80258F18-80258F5C .text getByUserIndex__18JPAEmitterResourceFUs */
|
||||
void JPAEmitterResource::getByUserIndex(unsigned short) {
|
||||
/* Nonmatching */
|
||||
JPAEmitterData * JPAEmitterResource::getByUserIndex(u16 userIndex) {
|
||||
for (u32 i = 0; i < registNum; i++) {
|
||||
JPAEmitterData * data = pEmtrResArray[i];
|
||||
if (data->userIndex == userIndex)
|
||||
return data;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* 80258F5C-80258FA0 .text checkUserIndexDuplication__18JPAEmitterResourceFUs */
|
||||
void JPAEmitterResource::checkUserIndexDuplication(unsigned short) {
|
||||
/* Nonmatching */
|
||||
BOOL JPAEmitterResource::checkUserIndexDuplication(u16 userIndex) {
|
||||
for (u32 i = 0; i < registNum; i++) {
|
||||
JPAEmitterData * data = pEmtrResArray[i];
|
||||
if (data->userIndex == userIndex)
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* 80258FA0-80258FF4 .text __ct__18JPAResourceManagerFPCvP7JKRHeap */
|
||||
JPAResourceManager::JPAResourceManager(const void*, JKRHeap*) {
|
||||
/* Nonmatching */
|
||||
JPAResourceManager::JPAResourceManager(const void* data, JKRHeap* heap) {
|
||||
pHeap = heap != NULL ? heap : JKRHeap::getCurrentHeap();
|
||||
JPAEmitterArchiveLoaderDataBase::load((const u8*)data, pHeap, &pEmtrRes, &pTexRes);
|
||||
}
|
||||
|
||||
/* 80258FF4-802590B4 .text swapTexture__18JPAResourceManagerFPC7ResTIMGPCc */
|
||||
void JPAResourceManager::swapTexture(const ResTIMG*, const char*) {
|
||||
/* Nonmatching */
|
||||
const ResTIMG* JPAResourceManager::swapTexture(const ResTIMG* timg, const char* name) {
|
||||
const ResTIMG * oldTimg = NULL;
|
||||
|
||||
for (u32 i = 0; i < pTexRes->registNum; i++) {
|
||||
if (strcmp(name, pTexRes->pTexResArray[i]->getName()) == 0) {
|
||||
JUTTexture* tex = pTexRes->pTexResArray[i]->getJUTTexture();
|
||||
oldTimg = tex->getTexInfo();
|
||||
tex->storeTIMG(timg, (u8)0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return oldTimg;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user