// This function is called ONLY from the VVM after loading this DLL. // If this DLL is loaded from another source (not the VVM), it is not // to call this function. The VVM calls to give it the address to call // for debugger API requests, as well as those of the already loaded VVMOSS. u64 CALLTYPE mc_firstCallback(u32 tnDoNotLoadOptions) { ////////// // Load all VVM and VVMOSS functions ////// iLoadVvmFunctionsFromDll(); iLoadOssFunctionsFromDll(); ////////// // Tell each DLL to initialize itself ////// if ((tnDoNotLoadOptions & _DO_NOT_LOAD_VVM) != _DO_NOT_LOAD_VVM) { vvm_firstCallback(tnDoNotLoadOptions | _DO_NOT_LOAD_MC); vvm_bootstrapInitialization(); } if ((tnDoNotLoadOptions & _DO_NOT_LOAD_OSS) != _DO_NOT_LOAD_OSS) { oss_firstCallback(tnDoNotLoadOptions | _DO_NOT_LOAD_OSS); oss_bootstrapInitialization(); } ////////// // Load the resource, which contains text and graphics ////// iLoadResource(vvm_getLanguage(NULL)); // Indicate success return(1); }
////////// // // Called one time at startup to initialize the SDL library to handle the sound requests. // ////// void CALLTYPE oss_soundInitialize(void) { ////////// // Retrieve the necessary callbacks ////// iLoadVvmFunctionsFromDll(); iLoadOssFunctionsFromDll(); ////////// // Tell each DLL to initialize itself ////// vvm_firstCallback(0); vvm_bootstrapInitialization(); oss_firstCallback(0); oss_bootstrapInitialization(); ////////// // Setup the desired structure ////// memset(&gsdlDesired, 0, sizeof(gsdlDesired)); gsdlDesired.freq = gnFrequency; // 44.1 kHz gsdlDesired.format = AUDIO_S16SYS; // 16-bit signed audio gsdlDesired.channels = 1; // Mono gsdlDesired.samples = gnFrequency / 50; // Audio buffer (larger buffers reduces risk of dropouts but increases response time) gsdlDesired.callback = isound_sdl_callback; // Our callback function gsdlDesired.userdata = NULL; // No user data is passed ////////// // Open the audio device ////// glSDL_Initialized = false; if (SDL_Init(SDL_INIT_AUDIO) >= 0) { if (SDL_OpenAudio(&gsdlDesired, &gsdlObtained) >= 0) { // Reset the frequency and a shorthand for faster computation on tone generation glSDL_Initialized = true; gnFrequency = gsdlObtained.freq; // Store our actual frequency gfFrequencyMultiplier = (f32)_2PI / (f32)gnFrequency; } else { // Obtain the error char* error = SDL_GetError(); error = NULL; } } else { // Obtain the error char* error = SDL_GetError(); error = NULL; } }
////////// // // Called to load the OSS.DLL stuff, following the startup protocol. // ////// bool ivasm_loadAndInitializeOss(void) { // Load the DLL if (!iLoadOssFunctionsFromDll()) return(false); // Let it initialize itself oss_firstCallback(0); oss_bootstrapInitialization(); // We're good return(true); }
////////// // // Called to load the VVMOSS.DLL stuff, following the startup protocol. // ////// bool ivvm_loadAndInitializeVvmOss(void) { // Load the DLL if (!iLoadOssFunctionsFromDll()) return(false); // Let it initialize itself oss_firstCallback((u64)&vvm_debuggerInterfaceCallback); oss_bootstrapInitialization((u64)&vvm_debuggerInterfaceCallback); // Create our main message window if (!oss_createMessageWindow()) return(false); // Initialize our unique number critical section access InitializeCriticalSection(&gcsUniqueIdAccess); // We're good return(true); }
////////// // // This function is called ONLY from the VVM after loading this DLL. // If this DLL is loaded from another source (not the VVM), it is not // to call this function. The VVM calls to give it the address to call // for debugger API requests, as well as those of the already loaded VVMOSS. // ////// u64 CALLTYPE vvmt_firstCallback(u64 tnCallbackAddress) { ////////// // Load all VVM and VVMOSS functions ////// iLoadVvmFunctionsFromDll(); iLoadOssFunctionsFromDll(); ////////// // Tell each DLL to initialize itself ////// vvm_firstCallback(0); vvm_bootstrapInitialization(); oss_firstCallback(0); oss_bootstrapInitialization(); ////////// // Indicate success ////// return(0); }