Merge pull request #118 from uofw/dmacman

Dmacman
This commit is contained in:
artart78 2022-05-21 18:45:02 +02:00 committed by GitHub
commit 821469f271
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 1112 additions and 16 deletions

View File

@ -4,13 +4,34 @@
#include "common_header.h"
int sceKernelDmaOpQuit(u32*);
int sceKernelDmaOpAssign(u32*, int, int, int, int);
int sceKernelDmaOpSetCallback(u32*, int (*)(int, int), int);
int sceKernelDmaOpSetupLink(u32*, int, u32*);
int sceKernelDmaOpEnQueue(u32*);
int sceKernelDmaOpDeQueue(u32*);
u32 *sceKernelDmaOpAlloc(void);
int sceKernelDmaOpFree(u32*);
typedef struct SceDmaOp {
struct SceDmaOp *unk0; // Prev (for unrelated ops)
struct SceDmaOp *unk4; // Next (for unrelated ops)
struct SceDmaOp *unk8; // Prev (for linked ops)
struct SceDmaOp *next; // Next (for linked ops)
u32 unk16;
u32 unk20;
int (*callback)(int, int);
u16 unk28; // Status
u16 unk30;
u32 unk32;
u32 unk36;
u32 unk40;
u32 unk44;
u32 unk48;
u16 unk52; // id?
u16 unk54; // num ops in link
u32 unk56;
u32 unk60;
} SceDmaOp;
int sceKernelDmaOpQuit(SceDmaOp*);
int sceKernelDmaOpAssign(SceDmaOp*, int, int, int, int);
int sceKernelDmaOpSetCallback(SceDmaOp*, int (*)(int, int), int);
int sceKernelDmaOpSetupLink(SceDmaOp*, int, u32*);
int sceKernelDmaOpEnQueue(SceDmaOp*);
int sceKernelDmaOpDeQueue(SceDmaOp*);
SceDmaOp *sceKernelDmaOpAlloc(void);
s32 sceKernelDmaOpFree(SceDmaOp*);
int DmacManForKernel_E18A93A5(void*, void*);

View File

@ -52,7 +52,7 @@ typedef struct
u8 buf512[240]; // 512
u8 buf752[272]; // 752
u32 hwBuf[48]; // 1024
u32 *dmaPtr[3]; // 1216
SceDmaOp *dmaPtr[3]; // 1216
/* The audio event flag ID. */
SceUID evFlagId; // 1228
/* The audio channels structures. */
@ -201,7 +201,7 @@ s32 audioMixerThread()
SceAudio *userAudio = UCACHED(&g_audio);
memset(sp0, 0, sizeof(sp0));
SceAudio *uncachedAudio = KUNCACHED(&g_audio);
u32 *unk = g_audio.dmaPtr[0];
SceDmaOp *unk = g_audio.dmaPtr[0];
// 0328
for (;;)
{
@ -254,7 +254,7 @@ s32 audioMixerThread()
else
{
char shift = g_audio.volumeOffset;
char unk1 = unk[8] < (u32)&userAudio->buf240[16];
char unk1 = unk->unk32 < (u32)&userAudio->buf240[16];
u32 *dstBuf = (u32*)(uncachedAudio->buf0 + unk1 * 256);
// 0408
s32 *u32buf = sp0;
@ -923,7 +923,7 @@ int sceAudioInit()
sceKernelRegisterIntrHandler(10, 2, audioIntrHandler, 0, 0);
sceKernelEnableIntr(10);
sceKernelDcacheWritebackInvalidateRange(&g_audio, sizeof(g_audio));
g_audio.dmaPtr[0][8] = (int)UCACHED(&g_audio);
g_audio.dmaPtr[0]->unk32 = (int)UCACHED(&g_audio);
g_audio.unkCodecArg = 1;
g_audio.unkCodecArgSet = 0;
g_audio.inputInited = 0;
@ -1016,7 +1016,7 @@ int audioIntrHandler()
{
// 1A8C
sceKernelDmaOpQuit(g_audio.dmaPtr[0]);
g_audio.dmaPtr[0][8] = (u32)UCACHED(g_audio.buf240 + 16);
g_audio.dmaPtr[0]->unk32 = (u32)UCACHED(g_audio.buf240 + 16);
}
// 1A1C
if ((hwAttr & 2) != 0)
@ -1454,9 +1454,9 @@ s32 audioInputThread()
sceKernelExitThread(0);
return 0;
}
u32 *ptr1 = g_audio.dmaPtr[2];
SceDmaOp *ptr1 = g_audio.dmaPtr[2];
int curSampleCount = g_audio.inputCurSampleCnt;
int unk = (ptr1[9] < *(u8*)(0x80000000 + (u32)&g_audio.buf752[16])); // yes, it's correct, it reverses the kernel mode
int unk = (ptr1->unk36 < *(u8*)(0x80000000 + (u32)&g_audio.buf752[16])); // yes, it's correct, it reverses the kernel mode
short *uncached1 = KUNCACHED(&g_audio.buf512[unk << 8]);
char unk2 = g_audio.inputHwFreq;
u16 *ptr3 = g_audio.inputBuf;
@ -1528,7 +1528,7 @@ s32 audioInputThread()
while ((HW(0xBE00000C) & 4) != 0)
;
sceKernelDmaOpQuit(g_audio.dmaPtr[2]);
ptr1[2] = g_audio.flags;
HW(0xBE000008) = g_audio.flags;
audioInputSetup();
}
}

7
src/dmacman/Makefile Normal file
View File

@ -0,0 +1,7 @@
# Copyright (C) 2014 the uOFW team
# See the file COPYING for copying permission.
TARGET = dmacman
OBJS = dmacman.o
include ../../lib/build.mak

1032
src/dmacman/dmacman.c Normal file

File diff suppressed because it is too large Load Diff

36
src/dmacman/exports.exp Normal file
View File

@ -0,0 +1,36 @@
# Export file automatically generated with prxtool
PSP_BEGIN_EXPORTS
PSP_EXPORT_START(syslib, 0x0000, 0x8000)
PSP_EXPORT_FUNC_HASH(module_bootstart)
PSP_EXPORT_FUNC_HASH(module_start)
PSP_EXPORT_FUNC_HASH(module_reboot_before)
PSP_EXPORT_VAR_HASH(module_info)
PSP_EXPORT_VAR_HASH(module_sdk_version)
PSP_EXPORT_END
PSP_EXPORT_START(DmacManForKernel, 0x0011, 0x0001)
PSP_EXPORT_FUNC_NID(sceKernelDmaExit, 0x1C46158A)
PSP_EXPORT_FUNC_NID(sceKernelDmaOpLLIConcatenate, 0x1FC036B7)
PSP_EXPORT_FUNC_NID(sceKernelDmaChReserve, 0x2E3BC333)
PSP_EXPORT_FUNC_NID(sceKernelDmaRegisterDdrFlush, 0x32757C57)
PSP_EXPORT_FUNC_NID(sceKernelDmaOpEnQueue, 0x3BDEA96C)
PSP_EXPORT_FUNC_NID(sceKernelDmaOpSetupMemcpy, 0x3FAD5844)
PSP_EXPORT_FUNC_NID(sceKernelDmaOpAlloc, 0x59615199)
PSP_EXPORT_FUNC_NID(sceKernelDmaOpQuit, 0x5AF32783)
PSP_EXPORT_FUNC_NID(sceKernelDmaOpFree, 0x745E19EF)
PSP_EXPORT_FUNC_NID(sceKernelDmaSoftRequest, 0x7B9634E1)
PSP_EXPORT_FUNC_NID(sceKernelDmaOpSetupLink, 0x7D21A2EF)
PSP_EXPORT_FUNC_NID(sceKernelDmaOpAssignMultiple, 0x904110FC)
PSP_EXPORT_FUNC_NID(sceKernelDmaOpDeQueue, 0x92700CCD)
PSP_EXPORT_FUNC_NID(sceKernelDmaOpAllCancel, 0xA84B084B)
PSP_EXPORT_FUNC_NID(sceKernelDmaOpSetupNormal, 0xCE467D9B)
PSP_EXPORT_FUNC_NID(sceKernelDmaOpSetCallback, 0xD0358BE9)
PSP_EXPORT_FUNC_NID(sceKernelDmaOnDebugMode, 0xD3F62265)
PSP_EXPORT_FUNC_NID(sceKernelDmaChExclude, 0xD8BC3120)
PSP_EXPORT_FUNC_NID(sceKernelDmaOpSync, 0xDB286D65)
PSP_EXPORT_FUNC_NID(sceKernelDmaOpConcatenate, 0xE18A93A5)
PSP_EXPORT_FUNC_NID(sceKernelDmaOpAssign, 0xF64BAB99)
PSP_EXPORT_END
PSP_END_EXPORTS