Skip to content

Instantly share code, notes, and snippets.

@JunielKatarn
Created July 19, 2016 03:42
Show Gist options
  • Save JunielKatarn/1e0f46e297295d96cbbbedd22b7c87a3 to your computer and use it in GitHub Desktop.
Save JunielKatarn/1e0f46e297295d96cbbbedd22b7c87a3 to your computer and use it in GitHub Desktop.
Pass-through audio plugin implementation for Project64.
#include <stdint.h>
#include <Windows.h>
#define EXPORT __declspec(dllexport)
#define CALL __cdecl
typedef struct {
uint16_t Version;
uint16_t Type;
char Name[100];
int NormalMemory;
int MemoryBswaped;
} PLUGIN_INFO;
typedef struct {
HWND hwnd;
HINSTANCE hinst;
int MemoryBswaped;
uint8_t * HEADER;
uint8_t * RDRAM;
uint8_t * DMEM;
uint8_t * IMEM;
uint32_t * MI_INTR_REG;
uint32_t * AI_DRAM_ADDR_REG;
uint32_t * AI_LEN_REG;
uint32_t * AI_CONTROL_REG;
uint32_t * AI_STATUS_REG;
uint32_t * AI_DACRATE_REG;
uint32_t * AI_BITRATE_REG;
void(*CheckInterrupts)(void);
} AUDIO_INFO;
extern "C" {
BOOL WINAPI DllMain(HINSTANCE, DWORD, LPVOID) { return TRUE; }
EXPORT void CALL AiDacrateChanged(int) {}
EXPORT void CALL AiLenChanged(void) {}
EXPORT uint32_t CALL AiReadLength(void) { return 0; }
EXPORT void CALL AiUpdate(int) {}
EXPORT void CALL CloseDLL(void) {}
EXPORT void CALL DllAbout(HWND) {}
EXPORT void CALL DllConfig(HWND) {}
EXPORT void CALL DllTest(HWND) {}
EXPORT void CALL GetDllInfo(PLUGIN_INFO * info)
{
info->MemoryBswaped = TRUE;
info->NormalMemory = FALSE;
strcpy(info->Name, "Dummy Audio Plugin");
info->Type = 3; // Audio
info->Version = 0x0101;
}
EXPORT int32_t CALL InitiateAudio(AUDIO_INFO) { return 1; }
EXPORT void CALL ProcessAList(void) {}
EXPORT void CALL RomClosed(void) {}
EXPORT void CALL RomOpen(void) {}
EXPORT void CALL PluginLoaded(void) {}
EXPORT void CALL AiCallBack(void) {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment