// 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 VVM.DLL stuff, following the startup protocol. // ////// bool ivasm_loadAndInitializeVvm(void) { // Load the DLL if (!iLoadVvmFunctionsFromDll()) return(false); // Let it initialize itself vvm_firstCallback(0); vvm_bootstrapInitialization(); // We're good return(true); }
void iLoadDlls(void) { ////////// // Load VVM functions ////// if (!ivasm_loadAndInitializeVvm()) { // Unable to load, or instantiate the message window for the VVM printf("Unable to load VVM.DLL. Terminating with -1.\n"); exit(-1); } ////////// // Load OS-Specific functions ////// if (!ivasm_loadAndInitializeOss()) { // Unable to load, or instantiate the message window for the VVM printf("Unable to load OSS.DLL. Terminating with -2.\n"); exit(-2); } ////////// // Load Machine Code-Specific functions ////// if (!ivasm_loadAndInitializeMc()) { // Unable to load printf("Unable to load MC.DLL. Terminating with -1.\n"); exit(-3); } // Let it initialize itself vvm_bootstrapInitialization(); oss_bootstrapInitialization(); mc_bootstrapInitialization(); // Indicate the version we have loaded printf(mc_loadResourceAsciiText(IDS_LOADED), vvm_getVersion()); printf(mc_loadResourceAsciiText(IDS_LOADED), oss_getVersion()); printf(mc_loadResourceAsciiText(IDS_LOADED), mc_getVersion()); printf("---\n"); printf("---\n"); }
////////// // // 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); }