Skip to content

Commit

Permalink
stub dsound poof of concept upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
RadWolfie committed Jul 15, 2024
1 parent a13bec2 commit 13a672e
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 28 deletions.
64 changes: 60 additions & 4 deletions src/OOVPADatabase/DSound/3911.inl
Original file line number Diff line number Diff line change
Expand Up @@ -2113,6 +2113,14 @@ OOVPA_SIG_MATCH(
//
);

// ******************************************************************
// * CDirectSoundStream::Process (dummy)
// ******************************************************************
// dummy signature
OOVPA_SIG_HEADER_NO_XREF(CDirectSoundStream_Process,
0)
OOVPA_SIG_MATCH_DUMMY();

// ******************************************************************
// * CDirectSoundStream_Process
// ******************************************************************
Expand Down Expand Up @@ -2147,7 +2155,15 @@ OOVPA_SIG_MATCH(
);

// ******************************************************************
// * CDirectSoundStream_GetStatus
// * CDirectSoundStream::GetStatus (dummy)
// ******************************************************************
// dummy signature
OOVPA_SIG_HEADER_NO_XREF(CDirectSoundStream_GetStatus,
0)
OOVPA_SIG_MATCH_DUMMY();

// ******************************************************************
// * CDirectSoundStream::GetStatus
// ******************************************************************
OOVPA_SIG_HEADER_NO_XREF(CDirectSoundStream_GetStatus,
3911)
Expand Down Expand Up @@ -2209,6 +2225,14 @@ OOVPA_SIG_MATCH(
//
);

// ******************************************************************
// * CDirectSoundStream::Flush (dummy)
// ******************************************************************
// dummy signature
OOVPA_SIG_HEADER_NO_XREF(CDirectSoundStream_Flush,
0)
OOVPA_SIG_MATCH_DUMMY();

// ******************************************************************
// * CDirectSoundStream_Flush
// ******************************************************************
Expand Down Expand Up @@ -2268,7 +2292,15 @@ OOVPA_SIG_MATCH(
);

// ******************************************************************
// * CDirectSoundStream_Discontinuity
// * CDirectSoundStream::Discontinuity (dummy)
// ******************************************************************
// dummy signature
OOVPA_SIG_HEADER_NO_XREF(CDirectSoundStream_Discontinuity,
0)
OOVPA_SIG_MATCH_DUMMY();

// ******************************************************************
// * CDirectSoundStream::Discontinuity
// ******************************************************************
OOVPA_SIG_HEADER_XREF(CDirectSoundStream_Discontinuity,
3911,
Expand Down Expand Up @@ -2296,7 +2328,15 @@ OOVPA_SIG_MATCH(
);

// ******************************************************************
// * CDirectSoundStream_GetInfo
// * CDirectSoundStream::GetInfo (dummy)
// ******************************************************************
// dummy signature
OOVPA_SIG_HEADER_NO_XREF(CDirectSoundStream_GetInfo,
0)
OOVPA_SIG_MATCH_DUMMY();

// ******************************************************************
// * CDirectSoundStream::GetInfo
// ******************************************************************
OOVPA_SIG_HEADER_NO_XREF(CDirectSoundStream_GetInfo,
3911)
Expand Down Expand Up @@ -3998,7 +4038,15 @@ OOVPA_SIG_MATCH(
);

// ******************************************************************
// * CDirectSoundStream_AddRef
// * CDirectSoundStream::AddRef (dummy)
// ******************************************************************
// dummy signature
OOVPA_SIG_HEADER_NO_XREF(CDirectSoundStream_AddRef,
0)
OOVPA_SIG_MATCH_DUMMY();

// ******************************************************************
// * CDirectSoundStream::AddRef
// ******************************************************************
OOVPA_SIG_HEADER_XREF(CDirectSoundStream_AddRef,
3911,
Expand Down Expand Up @@ -4054,6 +4102,14 @@ OOVPA_SIG_MATCH(
//
);

// ******************************************************************
// * CDirectSoundStream::Release (dummy)
// ******************************************************************
// dummy signature
OOVPA_SIG_HEADER_NO_XREF(CDirectSoundStream_Release,
0)
OOVPA_SIG_MATCH_DUMMY();

// ******************************************************************
// * CDirectSoundStream_Release
// ******************************************************************
Expand Down
29 changes: 22 additions & 7 deletions src/OOVPADatabase/DSound_OOVPA.inl
Original file line number Diff line number Diff line change
Expand Up @@ -453,20 +453,35 @@ OOVPATable DSound_OOVPA[] = {
#endif
#if 0 // These signatures are no longer in use, yet preserved as documented signatures for future research usage. \
// Instead of these signatures below, using CDirectSoundStream_Constructor signature plus manual work allow us to reduce the scan process.
REGISTER_OOVPAS(SYM_FUN(CDirectSoundStream_AddRef, STACK(/*default*/), PARAMS(/*unknown*/)),
REGISTER_OOVPAS(SYM_FUN(CDirectSoundStream_AddRef, STACK(/*default*/), PARAMS(PARAM(stk, pThis))),
SYM_SIG(3911, 4039, 4134)), // Final generic OOVPA: 4134; Removed: 0 // NOTE: The function and CAc97MediaObject::AddRef are the same asm code.
REGISTER_OOVPAS(SYM_FUN(CDirectSoundStream_Discontinuity, STACK(/*default*/), PARAMS(/*unknown*/)),
REGISTER_OOVPAS(SYM_FUN(CDirectSoundStream_Discontinuity, STACK(/*default*/), PARAMS(PARAM(stk, pThis))),
SYM_SIG(3911, 4039, 4134)), // Final generic OOVPA: 4134; Removed: 0
REGISTER_OOVPAS(SYM_FUN(CDirectSoundStream_Flush, STACK(/*default*/), PARAMS(/*unknown*/)),
REGISTER_OOVPAS(SYM_FUN(CDirectSoundStream_Flush, STACK(/*default*/), PARAMS(PARAM(stk, pThis))),
SYM_SIG(3911, 4039, 4134, 5028)), // Final generic OOVPA: 5028; Removed: 0
REGISTER_OOVPAS(SYM_FUN(CDirectSoundStream_GetInfo, STACK(/*default*/), PARAMS(/*unknown*/)),
REGISTER_OOVPAS(SYM_FUN(CDirectSoundStream_GetInfo, STACK(/*default*/), PARAMS(PARAM(stk, pThis), PARAM(stk, pInfo))),
SYM_SIG(3911, 4039, 4134)), // Final generic OOVPA: 4134; Removed: 0
REGISTER_OOVPAS(SYM_FUN(CDirectSoundStream_GetStatus, STACK(/*default*/), PARAMS(/*unknown*/)),
REGISTER_OOVPAS(SYM_FUN(CDirectSoundStream_GetStatus, STACK(/*default*/), PARAMS(PARAM(stk, pThis), PARAM(stk, pdwStatus))),
SYM_SIG(3911, 4039, 4134)), // Final generic OOVPA: 4134; Removed: 0
REGISTER_OOVPAS(SYM_FUN(CDirectSoundStream_Process, STACK(/*default*/), PARAMS(/*unknown*/)),
REGISTER_OOVPAS(SYM_FUN(CDirectSoundStream_Process, STACK(/*default*/), PARAMS(PARAM(stk, pThis), PARAM(stk, pInputBuffer), PARAM(stk, pOutputBuffer))),
SYM_SIG(3911, 4039, 4134)), // Final generic OOVPA: 4134; Removed: 0
REGISTER_OOVPAS(SYM_FUN(CDirectSoundStream_Release, STACK(/*default*/), PARAMS(/*unknown*/)),
REGISTER_OOVPAS(SYM_FUN(CDirectSoundStream_Release, STACK(/*default*/), PARAMS(PARAM(stk, pThis))),
SYM_SIG(3911, 4039, 4134)), // Final generic OOVPA: 4134; Removed: 0
#else
REGISTER_OOVPAS_M(SYM_FUN(CDirectSoundStream_AddRef, STACK(/*default*/), PARAMS(PARAM(stk, pThis))),
SYM_SIG(0)), // dummy signature // NOTE: The function and CAc97MediaObject::AddRef are the same asm code.
REGISTER_OOVPAS_M(SYM_FUN(CDirectSoundStream_Discontinuity, STACK(/*default*/), PARAMS(PARAM(stk, pThis))),
SYM_SIG(0)), // dummy signature
REGISTER_OOVPAS_M(SYM_FUN(CDirectSoundStream_Flush, STACK(/*default*/), PARAMS(PARAM(stk, pThis))),
SYM_SIG(0)), // dummy signature
REGISTER_OOVPAS_M(SYM_FUN(CDirectSoundStream_GetInfo, STACK(/*default*/), PARAMS(PARAM(stk, pThis), PARAM(stk, pInfo))),
SYM_SIG(0)), // dummy signature
REGISTER_OOVPAS_M(SYM_FUN(CDirectSoundStream_GetStatus, STACK(/*default*/), PARAMS(PARAM(stk, pThis), PARAM(stk, pdwStatus))),
SYM_SIG(0)), // dummy signature
REGISTER_OOVPAS_M(SYM_FUN(CDirectSoundStream_Process, STACK(/*default*/), PARAMS(PARAM(stk, pThis), PARAM(stk, pInputBuffer), PARAM(stk, pOutputBuffer))),
SYM_SIG(0)), // dummy signature
REGISTER_OOVPAS_M(SYM_FUN(CDirectSoundStream_Release, STACK(/*default*/), PARAMS(PARAM(stk, pThis))),
SYM_SIG(0)), // dummy signature
#endif
REGISTER_OOVPAS(SYM_FUN(CDirectSoundStream_FlushEx, STACK(/*default*/), PARAMS(/*unknown*/)),
SYM_SIG(4134)), // Final generic OOVPA: 4134; Removed: 0 (introduced in 4134)
Expand Down
33 changes: 16 additions & 17 deletions src/lib/manual_dsound.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,33 +81,32 @@ static bool manual_scan_section_dsound(iXbSymbolContext* pContext,

if (xblower <= vtable && vtable < xbupper) {
pFuncAddr = (memptr_t)virt_start_relative + vtable;
// TODO: FIXME! BELOW ARE FUNCTIONS, TRY RETREIVE INFO SOMEHOW FOR PARAMETERS???
internal_RegisterSymbol_M(pContext, pLibrarySession, XREF_CDirectSoundStream_AddRef, 3911,
"CDirectSoundStream_AddRef", *(uint32_t*)(pFuncAddr + 0 * 4), symbol_function, 0, NULL);
const OOVPATable* pSymbol = NULL;
internal_FindByReferenceHelper(pContext, pLibraryDB, pSymbol, CDirectSoundStream_AddRef);
internal_RegisterSymbolHelper(pContext, pLibrarySession, pSymbol, pSymbol->szSymbolName, 3911, *(uint32_t*)(pFuncAddr + 0 * 4));

internal_RegisterSymbol_M(pContext, pLibrarySession, XREF_CDirectSoundStream_Release, 3911,
"CDirectSoundStream_Release", *(uint32_t*)(pFuncAddr + 1 * 4), symbol_function, 0, NULL);
internal_FindByReferenceHelper(pContext, pLibraryDB, pSymbol, CDirectSoundStream_Release);
internal_RegisterSymbolHelper(pContext, pLibrarySession, pSymbol, pSymbol->szSymbolName, 3911, *(uint32_t*)(pFuncAddr + 1 * 4));

internal_RegisterSymbol_M(pContext, pLibrarySession, XREF_CDirectSoundStream_GetInfo, 3911,
"CDirectSoundStream_GetInfo", *(uint32_t*)(pFuncAddr + 2 * 4), symbol_function, 0, NULL);
internal_FindByReferenceHelper(pContext, pLibraryDB, pSymbol, CDirectSoundStream_GetInfo);
internal_RegisterSymbolHelper(pContext, pLibrarySession, pSymbol, pSymbol->szSymbolName, 3911, *(uint32_t*)(pFuncAddr + 2 * 4));

internal_FindByReferenceHelper(pContext, pLibraryDB, pSymbol, CDirectSoundStream_GetStatus);
if (pLibrary->build_version < 4134) {
internal_RegisterSymbol_M(pContext, pLibrarySession, XREF_CDirectSoundStream_GetStatus, 3911,
"CDirectSoundStream_GetStatus__r1", *(uint32_t*)(pFuncAddr + 3 * 4), symbol_function, 0, NULL);
internal_RegisterSymbolHelper(pContext, pLibrarySession, pSymbol, "CDirectSoundStream_GetStatus__r1", 3911, *(uint32_t*)(pFuncAddr + 3 * 4));
}
else {
internal_RegisterSymbol_M(pContext, pLibrarySession, XREF_CDirectSoundStream_GetStatus, 4134,
"CDirectSoundStream_GetStatus__r2", *(uint32_t*)(pFuncAddr + 3 * 4), symbol_function, 0, NULL);
internal_RegisterSymbolHelper(pContext, pLibrarySession, pSymbol, "CDirectSoundStream_GetStatus__r2", 4134, *(uint32_t*)(pFuncAddr + 3 * 4));
}

internal_RegisterSymbol_M(pContext, pLibrarySession, XREF_CDirectSoundStream_Process, 3911,
"CDirectSoundStream_Process", *(uint32_t*)(pFuncAddr + 4 * 4), symbol_function, 0, NULL);
internal_FindByReferenceHelper(pContext, pLibraryDB, pSymbol, CDirectSoundStream_Process);
internal_RegisterSymbolHelper(pContext, pLibrarySession, pSymbol, pSymbol->szSymbolName, 3911, *(uint32_t*)(pFuncAddr + 4 * 4));

internal_RegisterSymbol_M(pContext, pLibrarySession, XREF_CDirectSoundStream_Discontinuity, 3911,
"CDirectSoundStream_Discontinuity", *(uint32_t*)(pFuncAddr + 5 * 4), symbol_function, 0, NULL);
internal_FindByReferenceHelper(pContext, pLibraryDB, pSymbol, CDirectSoundStream_Discontinuity);
internal_RegisterSymbolHelper(pContext, pLibrarySession, pSymbol, pSymbol->szSymbolName, 3911, *(uint32_t*)(pFuncAddr + 5 * 4));

internal_RegisterSymbol_M(pContext, pLibrarySession, XREF_CDirectSoundStream_Flush, 3911,
"CDirectSoundStream_Flush", *(uint32_t*)(pFuncAddr + 6 * 4), symbol_function, 0, NULL);
internal_FindByReferenceHelper(pContext, pLibraryDB, pSymbol, CDirectSoundStream_Flush);
internal_RegisterSymbolHelper(pContext, pLibrarySession, pSymbol, pSymbol->szSymbolName, 3911, *(uint32_t*)(pFuncAddr + 6 * 4));

// NOTE: it is possible to manual add GetInfo, GetStatus, Process, Discontinuity,
// and Flush functions.
Expand Down

0 comments on commit 13a672e

Please sign in to comment.