void retro_run() { input_poll_cb(); update_input(); static int16_t sound_buf[0x10000]; static MDFN_Rect rects[384]; EmulateSpecStruct spec = {0}; spec.surface = surf; spec.SoundRate = 48000; spec.SoundBuf = sound_buf; spec.LineWidths = rects; spec.SoundBufMaxSize = sizeof(sound_buf) / 2; spec.SoundVolume = 1.0; spec.soundmultiplier = 1.0; MDFNI_Emulate(&spec); //unsigned width = rects[0].w; //unsigned height = spec.DisplayRect.h; unsigned width = 384; unsigned height = 224; convert_surface(); video_cb(conv_buf, width, height, width << 1); audio_batch_cb(spec.SoundBuf, spec.SoundBufSize); }
unsigned int CTextureController::LoadTexture(char* TextureFile) { // Attempt to load the texture file. If it can not be loaded, return. SDL_Surface* NewSurface = IMG_Load(TextureFile); if (NewSurface == NULL) { SDL_FreeSurface(NewSurface); return INDEX_NOIMAGE; } unsigned int Image = convert_surface(NewSurface); SDL_FreeSurface(NewSurface); // If you can find a texture that has the same filename, return the ID for (unsigned int i = 0; i < (unsigned int)TextureList.size(); ++i) if (strcmp(TextureList[i].Filename, TextureFile) == 0) return i; // If you can find a texture that has been cleared, define it and return the ID for (unsigned int i = 0; i < (unsigned int)TextureList.size(); ++i) { if (TextureList[i].References == 0) { TextureList[i].Image = Image; strcpy_s(TextureList[i].Filename, strlen(TextureFile) + 1, TextureFile); TextureList[i].References = 1; return i; } } // If no cleared texture has been found, create a new one Texture T; T.Image = Image; strcpy_s(T.Filename, strlen(TextureFile) + 1, TextureFile); T.References = 1; TextureList.push_back(T); return (unsigned int)(TextureList.size() - 1); }
void retro_run() { input_poll_cb(); update_input(); static int16_t sound_buf[0x10000]; static MDFN_Rect rects[480]; rects[0].w = ~0; EmulateSpecStruct spec = {0}; spec.surface = surf; spec.SoundRate = 44100; spec.SoundBuf = sound_buf; spec.LineWidths = rects; spec.SoundBufMaxSize = sizeof(sound_buf) / 2; spec.SoundVolume = 1.0; spec.soundmultiplier = 1.0; MDFNI_Emulate(&spec); unsigned width = rects[0].w; unsigned height = spec.DisplayRect.h; if (rgb32) { // FIXME: Avoid black borders. Cannot see how DisplayRect exposes this. const uint32_t *ptr = mednafen_buf; if (width == 340) { ptr += 10; width = 320; } else if (width == 680) { ptr += 20; width = 640; } video_cb(ptr, width, height, 680 << 2); } else { convert_surface(); const uint16_t *ptr = conv_buf; if (width == 340) { ptr += 10; width = 320; } else if (width == 680) { ptr += 20; width = 640; } video_cb(ptr, width, height, 680 << 1); } audio_batch_cb(spec.SoundBuf, spec.SoundBufSize); }