diff --git a/source/cpu_cores/z80/z80.c b/source/cpu_cores/z80/z80.c index d389fbb..d49193e 100644 --- a/source/cpu_cores/z80/z80.c +++ b/source/cpu_cores/z80/z80.c @@ -1214,7 +1214,7 @@ INLINE void bit_xy(int bit, uint8_t value) /*************************************************************** * RES bit,r8 ***************************************************************/ -INLINE uint8_t res(int bit, uint8_t value) +INLINE uint8_t res_z80(int bit, uint8_t value) { return value & ~(1<pixels; bitmap.pitch = sms_bitmap->pitch; bitmap.viewport.w = VIDEO_WIDTH_SMS; @@ -1070,18 +1067,20 @@ int main (int argc, char *argv[]) // Initialize all systems and power on system_poweron(); + Sound_Init(); + // Loop until the user closes the window while (!quit) { // Execute frame(s) system_frame(0); + // Refresh sound data + Sound_Update(snd.output, snd.sample_count); + // Refresh video data video_update(); - // Output audio - Sound_Update(); - if (selectpressed == 1) { Menu(); diff --git a/source/ports/amini/smsplus.c b/source/ports/amini/smsplus.c index 4f38c6c..53aa094 100644 --- a/source/ports/amini/smsplus.c +++ b/source/ports/amini/smsplus.c @@ -728,7 +728,6 @@ int main (int argc, char *argv[]) bitmap.width = VIDEO_WIDTH_SMS; bitmap.height = VIDEO_HEIGHT_SMS; bitmap.depth = 16; - bitmap.granularity = 2; bitmap.data = (uint8_t *)sms_bitmap->pixels; bitmap.pitch = sms_bitmap->pitch; bitmap.viewport.w = VIDEO_WIDTH_SMS; @@ -743,12 +742,12 @@ int main (int argc, char *argv[]) } bios_init(); - - Sound_Init(); // Initialize all systems and power on system_poweron(); + Sound_Init(); + // Loop until the user closes the window while (!quit) { @@ -758,8 +757,8 @@ int main (int argc, char *argv[]) // Refresh video data video_update(); - // Output audio - Sound_Update(); + // Refresh sound data + Sound_Update(snd.output, snd.sample_count); if (selectpressed == 1) { diff --git a/source/ports/bittboy/smsplus.c b/source/ports/bittboy/smsplus.c index 6cfeb4a..a757c08 100644 --- a/source/ports/bittboy/smsplus.c +++ b/source/ports/bittboy/smsplus.c @@ -957,7 +957,6 @@ int main (int argc, char *argv[]) bitmap.width = VIDEO_WIDTH_SMS; bitmap.height = VIDEO_HEIGHT_SMS; bitmap.depth = 16; - bitmap.granularity = 2; bitmap.data = (uint8_t *)sms_bitmap->pixels; bitmap.pitch = sms_bitmap->pitch; bitmap.viewport.w = VIDEO_WIDTH_SMS; @@ -980,11 +979,11 @@ int main (int argc, char *argv[]) // Execute frame(s) system_frame(0); + // Refresh sound data + Sound_Update(snd.output, snd.sample_count); + // Refresh video data video_update(); - - // Output audio - Sound_Update(); if (selectpressed == 1) { diff --git a/source/ports/fbdev/smsplus.c b/source/ports/fbdev/smsplus.c index 72a2d00..645608d 100644 --- a/source/ports/fbdev/smsplus.c +++ b/source/ports/fbdev/smsplus.c @@ -688,8 +688,6 @@ int main (int argc, char *argv[]) vinfo.yoffset = 0; ioctl(fbfd, FBIOPAN_DISPLAY, &vinfo); - Sound_Init(); - #ifdef SCALE2X_UPSCALER scale2x_buf = malloc(((VIDEO_WIDTH_SMS*2)*480)*sizeof(uint16_t)); #endif @@ -700,7 +698,6 @@ int main (int argc, char *argv[]) bitmap.width = VIDEO_WIDTH_SMS; bitmap.height = VIDEO_HEIGHT_SMS; bitmap.depth = 16; - bitmap.granularity = 2; bitmap.data = (uint8_t *)sms_bitmap; bitmap.pitch = 512; bitmap.viewport.w = VIDEO_WIDTH_SMS; @@ -716,6 +713,8 @@ int main (int argc, char *argv[]) // Initialize all systems and power on system_poweron(); + + Sound_Init(); Clear_buffers(); @@ -725,6 +724,9 @@ int main (int argc, char *argv[]) // Execute frame(s) system_frame(0); + // Refresh sound data + Sound_Update(snd.output, snd.sample_count); + // Refresh video data video_update(); @@ -736,9 +738,6 @@ int main (int argc, char *argv[]) } Controls(); - - // Output audio - Sound_Update(); } config_save(); diff --git a/source/ports/gameta/smsplus.c b/source/ports/gameta/smsplus.c index 695aff5..32bdc0a 100644 --- a/source/ports/gameta/smsplus.c +++ b/source/ports/gameta/smsplus.c @@ -637,7 +637,6 @@ int main (int argc, char *argv[]) bitmap.width = VIDEO_WIDTH_SMS; bitmap.height = VIDEO_HEIGHT_SMS; bitmap.depth = 16; - bitmap.granularity = 2; bitmap.data = (uint8_t *)sms_bitmap->pixels; bitmap.pitch = sms_bitmap->pitch; bitmap.viewport.w = VIDEO_WIDTH_SMS; @@ -660,11 +659,11 @@ int main (int argc, char *argv[]) // Execute frame(s) system_frame(0); + // Refresh sound data + Sound_Update(snd.output, snd.sample_count); + // Refresh video data video_update(); - - // Output audio - Sound_Update(); if (selectpressed == 1) { diff --git a/source/ports/gcw0/smsplus.c b/source/ports/gcw0/smsplus.c index 8606420..bb5fe9e 100644 --- a/source/ports/gcw0/smsplus.c +++ b/source/ports/gcw0/smsplus.c @@ -1111,7 +1111,6 @@ int main (int argc, char *argv[]) bitmap.width = VIDEO_WIDTH_SMS; bitmap.height = VIDEO_HEIGHT_SMS; bitmap.depth = 16; - bitmap.granularity = 2; bitmap.data = (uint8_t *)sms_bitmap->pixels; bitmap.pitch = sms_bitmap->pitch; bitmap.viewport.w = VIDEO_WIDTH_SMS; @@ -1197,9 +1196,6 @@ int main (int argc, char *argv[]) // Refresh video data video_update(); - // Output audio - Sound_Update(); - if (selectpressed == 1) { update_window_size(HOST_WIDTH_RESOLUTION, HOST_HEIGHT_RESOLUTION, 1); diff --git a/source/ports/k3s/smsplus.c b/source/ports/k3s/smsplus.c index 16c431b..0a2a65b 100644 --- a/source/ports/k3s/smsplus.c +++ b/source/ports/k3s/smsplus.c @@ -108,8 +108,6 @@ static void video_update() case 2: // Fullscreen (cropped) if (sms.console == CONSOLE_GG) { - dst.x = 0; - dst.y = 0; dst.w = sdl_screen->w; dst.h = sdl_screen->h; dstT.x = 48; @@ -119,8 +117,6 @@ static void video_update() } else { - dst.x = 0; - dst.y = 0; dst.w = sdl_screen->w; dst.h = sdl_screen->h; dstT.x = (vdp.reg[0] & 0x20) ? 8 : 0; @@ -807,7 +803,6 @@ int main (int argc, char *argv[]) bitmap.width = VIDEO_WIDTH_SMS; bitmap.height = VIDEO_HEIGHT_SMS; bitmap.depth = 16; - bitmap.granularity = 2; bitmap.data = (uint8_t *)sms_bitmap->pixels; bitmap.pitch = sms_bitmap->pitch; bitmap.viewport.w = VIDEO_WIDTH_SMS; @@ -823,11 +818,11 @@ int main (int argc, char *argv[]) bios_init(); - Sound_Init(); - // Initialize all systems and power on system_poweron(); + Sound_Init(); + // Loop until the user closes the window while (!quit) { @@ -837,8 +832,8 @@ int main (int argc, char *argv[]) // Refresh video data video_update(); - // Output audio - Sound_Update(); + // Refresh sound data + Sound_Update(snd.output, snd.sample_count); if (sms.console == CONSOLE_COLECO) { diff --git a/source/ports/retrostone/smsplus.c b/source/ports/retrostone/smsplus.c index 9673836..2b27630 100644 --- a/source/ports/retrostone/smsplus.c +++ b/source/ports/retrostone/smsplus.c @@ -974,7 +974,6 @@ int main (int argc, char *argv[]) bitmap.width = VIDEO_WIDTH_SMS; bitmap.height = VIDEO_HEIGHT_SMS; bitmap.depth = 16; - bitmap.granularity = 2; bitmap.data = (uint8_t *)sms_bitmap->pixels; bitmap.pitch = sms_bitmap->pitch; bitmap.viewport.w = VIDEO_WIDTH_SMS; @@ -997,11 +996,11 @@ int main (int argc, char *argv[]) // Execute frame(s) system_frame(0); + // Refresh sound data + Sound_Update(snd.output, snd.sample_count); + // Refresh video data video_update(); - - // Output audio - Sound_Update(); if (selectpressed == 1) { diff --git a/source/ports/rs90/smsplus.c b/source/ports/rs90/smsplus.c index 0113af6..599d25e 100644 --- a/source/ports/rs90/smsplus.c +++ b/source/ports/rs90/smsplus.c @@ -12,11 +12,11 @@ #include "smsplus.h" #include "font_drawing.h" -/* TODO : We really need to do something about the tearing. - * This is not the only port affected btw but still. */ - +#ifdef NOYUV SDL_Color palette_8bpp[256]; -uint8_t drm_palette[3][256]; +#else +static uint8_t drm_palette[3][256]; +#endif static gamedata_t gdata; @@ -27,9 +27,8 @@ SDL_Surface *sms_bitmap; static char home_path[256]; -static uint8_t selectpressed = 0; -static uint8_t save_slot = 0; -static uint8_t quit = 0; +static uint_fast8_t save_slot = 0; +static uint_fast8_t quit = 0; #ifndef NOYUV #define UINT16_16(val) ((uint32_t)(val * (float)(1<<16))) @@ -40,22 +39,18 @@ static const uint32_t YUV_MAT[3][3] = { }; #endif -uint_fast8_t forcerefresh = 0; -uint_fast16_t remember_res_height = 240, width_remember = 256; -uint_fast16_t pixels_shifting_remove; - +static uint_fast8_t forcerefresh = 0; static uint32_t update_window_size(uint32_t w, uint32_t h); +static uint8_t* dst_yuv[3]; + /* This is solely relying on the IPU chip implemented in the kernel * for centering, scaling (with bilinear filtering) etc... */ static void video_update(void) { - uint16_t height; - uint16_t width; - uint16_t i; - uint_fast8_t j, a, plane; - uint8_t* dst_yuv[3]; + uint_fast16_t height, width, i, pixels_shifting_remove; + uint_fast8_t a, plane; if (sms.console == CONSOLE_GG) { @@ -65,7 +60,7 @@ static void video_update(void) pixels_shifting_remove = (256 * 24) + 48; height = 144; width = 160; - if (remember_res_height != 144 || forcerefresh == 1) + if (sdl_screen->h != 144 || forcerefresh == 1) { update_window_size(160, 144); forcerefresh = 0; @@ -76,7 +71,7 @@ static void video_update(void) pixels_shifting_remove = (vdp.reg[0] & 0x20) ? 8 : 0; height = vdp.height; width = 256 - pixels_shifting_remove; - if (width != width_remember || remember_res_height != vdp.height || forcerefresh == 1) + if (width != sdl_screen->w || sdl_screen->h != vdp.height || forcerefresh == 1) { update_window_size(width, vdp.height); forcerefresh = 0; @@ -85,24 +80,26 @@ static void video_update(void) /* Yes, this mess is really for the 8-bits palette mode.*/ if (bitmap.pal.update == 1){ - for(i = 0; i < PALETTE_SIZE; i += 1){ - if(bitmap.pal.dirty[i]){ - for(a=0;a<8;a++){ + for(i = 0; i < PALETTE_SIZE; i += 1) + { + if(bitmap.pal.dirty[i]) + { + for(a=0;a<8;a++) + { + #ifdef NOYUV palette_8bpp[i+(a*32)].r = (bitmap.pal.color[i][0]); palette_8bpp[i+(a*32)].g = (bitmap.pal.color[i][1]); palette_8bpp[i+(a*32)].b = (bitmap.pal.color[i][2]); + #else + /* Set DRM palette */ + drm_palette[0][i+(a*32)] = ( ( UINT16_16( 0) + YUV_MAT[0][0] * bitmap.pal.color[i][0] + YUV_MAT[0][1] * bitmap.pal.color[i][1] + YUV_MAT[0][2] * bitmap.pal.color[i][2]) >> 16 ); + drm_palette[1][i+(a*32)] = ( ( UINT16_16(128) - YUV_MAT[1][0] * bitmap.pal.color[i][0] - YUV_MAT[1][1] * bitmap.pal.color[i][1] + YUV_MAT[1][2] * bitmap.pal.color[i][2]) >> 16 ); + drm_palette[2][i+(a*32)] = ( ( UINT16_16(128) + YUV_MAT[2][0] * bitmap.pal.color[i][0] - YUV_MAT[2][1] * bitmap.pal.color[i][1] - YUV_MAT[2][2] * bitmap.pal.color[i][2]) >> 16 ); + #endif } } } - - /* Set DRM palette */ - #ifndef NOYUV - for (i = 0; i < 256; i++){ - drm_palette[0][i] = ( ( UINT16_16( 0) + YUV_MAT[0][0] * palette_8bpp[i].r + YUV_MAT[0][1] * palette_8bpp[i].g + YUV_MAT[0][2] * palette_8bpp[i].b) >> 16 ); - drm_palette[1][i] = ( ( UINT16_16(128) - YUV_MAT[1][0] * palette_8bpp[i].r - YUV_MAT[1][1] * palette_8bpp[i].g + YUV_MAT[1][2] * palette_8bpp[i].b) >> 16 ); - drm_palette[2][i] = ( ( UINT16_16(128) + YUV_MAT[2][0] * palette_8bpp[i].r - YUV_MAT[2][1] * palette_8bpp[i].g - YUV_MAT[2][2] * palette_8bpp[i].b) >> 16 ); - } - #else + #ifdef NOYUV SDL_SetPalette(sms_bitmap, SDL_LOGPAL|SDL_PHYSPAL, palette_8bpp, 0, 256); SDL_SetPalette(sdl_screen, SDL_LOGPAL|SDL_PHYSPAL, palette_8bpp, 0, 256); #endif @@ -118,7 +115,6 @@ static void video_update(void) * However Johnny's code is not used because during my testing it was slower. * He still helped me understand the YUV code though, so thanks. * */ - uint32_t srcwidth = sms_bitmap->w; uint8_t *srcbase = sms_bitmap->pixels + pixels_shifting_remove; dst_yuv[0] = sdl_screen->pixels; dst_yuv[1] = dst_yuv[0] + height * sdl_screen->pitch; @@ -129,7 +125,7 @@ static void video_update(void) register uint8_t *pal = drm_palette[plane]; for (y=0; y < height; y++) /* The number of lines to copy */ { - register uint8_t *src = srcbase + (y*srcwidth); + register uint8_t *src = srcbase + (y*sms_bitmap->w); register uint8_t *end = src + width; register uint32_t *dst = (uint32_t *)&dst_yuv[plane][width * y]; @@ -223,11 +219,41 @@ void system_manage_sram(uint8_t *sram, uint8_t slot_number, uint8_t mode) } } -static uint32_t sdl_controls_update_input(SDLKey k, int32_t p) +static uint32_t sdl_controls_update_input_down(SDLKey k) { + if (k == option.config_buttons[CONFIG_BUTTON_UP]) + { + input.pad[0] |= INPUT_UP; + } + else if (k == option.config_buttons[CONFIG_BUTTON_LEFT]) + { + input.pad[0] |= INPUT_LEFT; + } + else if (k == option.config_buttons[CONFIG_BUTTON_RIGHT]) + { + input.pad[0] |= INPUT_RIGHT; + } + else if (k == option.config_buttons[CONFIG_BUTTON_DOWN]) + { + input.pad[0] |= INPUT_DOWN; + } + else if (k == option.config_buttons[CONFIG_BUTTON_BUTTON1]) + { + input.pad[0] |= INPUT_BUTTON1; + } + else if (k == option.config_buttons[CONFIG_BUTTON_BUTTON2]) + { + input.pad[0] |= INPUT_BUTTON2; + } + else if (k == option.config_buttons[CONFIG_BUTTON_START]) + { + input.system |= (sms.console == CONSOLE_GG) ? INPUT_START : INPUT_PAUSE; + } + /* We can't use switch... case because we are not using constants */ if (sms.console == CONSOLE_COLECO) { + input.system = 0; coleco.keypad[0] = 0xff; coleco.keypad[1] = 0xff; @@ -244,61 +270,38 @@ static uint32_t sdl_controls_update_input(SDLKey k, int32_t p) else if (k == option.config_buttons[CONFIG_BUTTON_ASTERISK]) coleco.keypad[0] = 11; } + return 1; +} + +static uint32_t sdl_controls_update_input_release(SDLKey k) +{ if (k == option.config_buttons[CONFIG_BUTTON_UP]) { - if (p) - input.pad[0] |= INPUT_UP; - else - input.pad[0] &= ~INPUT_UP; + input.pad[0] &= ~INPUT_UP; } else if (k == option.config_buttons[CONFIG_BUTTON_LEFT]) { - if (p) - input.pad[0] |= INPUT_LEFT; - else - input.pad[0] &= ~INPUT_LEFT; + input.pad[0] &= ~INPUT_LEFT; } else if (k == option.config_buttons[CONFIG_BUTTON_RIGHT]) { - if (p) - input.pad[0] |= INPUT_RIGHT; - else - input.pad[0] &= ~INPUT_RIGHT; + input.pad[0] &= ~INPUT_RIGHT; } else if (k == option.config_buttons[CONFIG_BUTTON_DOWN]) { - if (p) - input.pad[0] |= INPUT_DOWN; - else - input.pad[0] &= ~INPUT_DOWN; + input.pad[0] &= ~INPUT_DOWN; } else if (k == option.config_buttons[CONFIG_BUTTON_BUTTON1]) { - if (p) - input.pad[0] |= INPUT_BUTTON1; - else - input.pad[0] &= ~INPUT_BUTTON1; + input.pad[0] &= ~INPUT_BUTTON1; } else if (k == option.config_buttons[CONFIG_BUTTON_BUTTON2]) { - if (p) - input.pad[0] |= INPUT_BUTTON2; - else - input.pad[0] &= ~INPUT_BUTTON2; + input.pad[0] &= ~INPUT_BUTTON2; } else if (k == option.config_buttons[CONFIG_BUTTON_START]) { - if (p) - input.system |= (sms.console == CONSOLE_GG) ? INPUT_START : INPUT_PAUSE; - else - input.system &= (sms.console == CONSOLE_GG) ? ~INPUT_START : ~INPUT_PAUSE; - } - else if (k == SDLK_RCTRL || k == SDLK_ESCAPE) - { - if (p) - selectpressed = 1; - else - selectpressed = 0; + input.system &= (sms.console == CONSOLE_GG) ? ~INPUT_START : ~INPUT_PAUSE; } if (sms.console == CONSOLE_COLECO) input.system = 0; @@ -399,53 +402,40 @@ static const char* Return_Text_Button(uint32_t button) /* UP button */ case 273: return "DPAD UP"; - break; /* DOWN button */ case 274: return "DPAD DOWN"; - break; /* LEFT button */ case 276: return "DPAD LEFT"; - break; /* RIGHT button */ case 275: return "DPAD RIGHT"; - break; /* A button */ case 306: return "A button"; - break; /* B button */ case 308: return "B button"; - break; /* X button */ case 304: return "X button"; - break; /* Y button */ case 32: return "Y button"; - break; /* L button */ case 9: return "L Shoulder"; - break; /* R button */ case 8: return "R Shoulder"; - break; /* Start */ case 13: return "Start button"; - break; case 27: return "Select button"; - break; default: return "..."; - break; } } @@ -540,7 +530,7 @@ static void Input_Remapping() default: SDL_FillRect( backbuffer, NULL, 0 ); print_string("Press button for mapping", TextWhite, TextBlue, 24, 64, backbuffer->pixels); - bitmap_scale(0,0,240,160,sdl_screen->w,sdl_screen->h,240,0,(uint16_t* restrict)backbuffer->pixels,(uint16_t* restrict)sdl_screen->pixels); + SDL_BlitSurface(backbuffer, NULL, sdl_screen, NULL); SDL_Flip(sdl_screen); exit_map = 0; while( !exit_map ) @@ -636,26 +626,23 @@ static void Input_Remapping() if (currentselection == 11) print_string(text, TextRed, 0, 145, 65, backbuffer->pixels); else print_string(text, TextWhite, 0, 145, 65, backbuffer->pixels); } - - bitmap_scale(0,0,240,160,sdl_screen->w,sdl_screen->h,240,0,(uint16_t* restrict)backbuffer->pixels,(uint16_t* restrict)sdl_screen->pixels); + SDL_BlitSurface(backbuffer, NULL, sdl_screen, NULL); SDL_Flip(sdl_screen); } } -void Menu() +static void Menu() { uint_fast8_t i; char text[50]; int16_t pressed = 0; int16_t currentselection = 1; - - SDL_Rect dstRect; SDL_Event Event; sdl_screen = SDL_SetVideoMode(HOST_WIDTH_RESOLUTION, HOST_HEIGHT_RESOLUTION, 16, SDL_SWSURFACE); - while (((currentselection != 1) && (currentselection != 8)) || (!pressed)) + while (((currentselection != 1) && (currentselection != 7)) || (!pressed)) { pressed = 0; SDL_FillRect( backbuffer, NULL, 0 ); @@ -674,25 +661,20 @@ void Menu() if (currentselection == 3) print_string(text, TextBlue, 0, 5, 51, backbuffer->pixels); else print_string(text, TextWhite, 0, 5, 51, backbuffer->pixels); - - snprintf(text, sizeof(text), "Sound volume : %d", option.soundlevel); - if (currentselection == 4) print_string(text, TextBlue, 0, 5, 63, backbuffer->pixels); - else print_string(text, TextWhite, 0, 5, 63, backbuffer->pixels); - - if (currentselection == 5) print_string("Input remapping", TextBlue, 0, 5, 75, backbuffer->pixels); - else print_string("Input remapping", TextWhite, 0, 5, 75, backbuffer->pixels); + if (currentselection == 4) print_string("Input remapping", TextBlue, 0, 5, 63, backbuffer->pixels); + else print_string("Input remapping", TextWhite, 0, 5, 63, backbuffer->pixels); snprintf(text, sizeof(text), "FM Sound : %d", option.fm); - if (currentselection == 6) print_string(text, TextBlue, 0, 5, 87, backbuffer->pixels); - else print_string(text, TextWhite, 0, 5, 87, backbuffer->pixels); + if (currentselection == 5) print_string(text, TextBlue, 0, 5, 75, backbuffer->pixels); + else print_string(text, TextWhite, 0, 5, 75, backbuffer->pixels); - if (currentselection == 7) print_string("Reset", TextBlue, 0, 5, 99, backbuffer->pixels); - else print_string("Reset", TextWhite, 0, 5, 99, backbuffer->pixels); + if (currentselection == 6) print_string("Reset", TextBlue, 0, 5, 87, backbuffer->pixels); + else print_string("Reset", TextWhite, 0, 5, 87, backbuffer->pixels); - if (currentselection == 8) print_string("Quit", TextBlue, 0, 5, 111, backbuffer->pixels); - else print_string("Quit", TextWhite, 0, 5, 111, backbuffer->pixels); + if (currentselection == 7) print_string("Quit", TextBlue, 0, 5, 99, backbuffer->pixels); + else print_string("Quit", TextWhite, 0, 5, 99, backbuffer->pixels); print_string("By gameblabla, ekeeke", TextWhite, 0, 5, 145, backbuffer->pixels); @@ -706,11 +688,11 @@ void Menu() case SDLK_UP: currentselection--; if (currentselection == 0) - currentselection = 8; + currentselection = 7; break; case SDLK_DOWN: currentselection++; - if (currentselection == 9) + if (currentselection == 8) currentselection = 1; break; case SDLK_LCTRL: @@ -725,12 +707,7 @@ void Menu() case 3: if (save_slot > 0) save_slot--; break; - case 4: - option.soundlevel--; - if (option.soundlevel < 1) - option.soundlevel = 4; - break; - case 6: + case 5: if (option.fm > 0) option.fm--; break; } @@ -744,12 +721,7 @@ void Menu() if (save_slot == 10) save_slot = 9; break; - case 4: - option.soundlevel++; - if (option.soundlevel > 4) - option.soundlevel = 1; - break; - case 6: + case 5: if (option.fm < 1) option.fm++; break; } @@ -768,20 +740,15 @@ void Menu() { switch(currentselection) { - case 7: + case 6: //reset Sound_Close(); Sound_Init(); system_poweron(); currentselection = 1; break; - case 5: - Input_Remapping(); - break; case 4: - option.soundlevel++; - if (option.soundlevel > 4) - option.soundlevel = 1; + Input_Remapping(); break; case 2 : smsp_state(save_slot, 1); @@ -806,7 +773,7 @@ void Menu() SDL_Flip(sdl_screen); } - if (currentselection == 8) + if (currentselection == 7) quit = 1; } @@ -886,14 +853,10 @@ uint32_t update_window_size(uint32_t w, uint32_t h) { if (h == 0) h = 192; #ifdef NOYUV - sdl_screen = SDL_SetVideoMode(w, h, 8, SDL_HWSURFACE | SDL_HWPALETTE); + sdl_screen = SDL_SetVideoMode(w, h, 8, SDL_HWSURFACE | SDL_TRIPLEBUF | SDL_HWPALETTE); #else - sdl_screen = SDL_SetVideoMode(w, h, 24, SDL_HWSURFACE | SDL_YUV444); + sdl_screen = SDL_SetVideoMode(w, h, 24, SDL_HWSURFACE | SDL_TRIPLEBUF | SDL_YUV444 | SDL_ANYFORMAT | SDL_FULLSCREEN); #endif - - width_remember = w; - remember_res_height = h; - return 0; } @@ -970,7 +933,6 @@ int main (int argc, char *argv[]) bitmap.width = VIDEO_WIDTH_SMS; bitmap.height = VIDEO_HEIGHT_SMS; bitmap.depth = 8; - bitmap.granularity = 1; bitmap.data = (uint8_t *)sms_bitmap->pixels; bitmap.pitch = sms_bitmap->pitch; bitmap.viewport.w = VIDEO_WIDTH_SMS; @@ -985,19 +947,27 @@ int main (int argc, char *argv[]) } bios_init(); - - Sound_Init(); + + option.sndrate = SOUND_FREQUENCY; // Initialize all systems and power on system_poweron(); + Sound_Init(); + for(i = 0; i < PALETTE_SIZE; i += 1) { if(bitmap.pal.dirty[i]) { + #ifdef NOYUV palette_8bpp[i].r = 0; palette_8bpp[i].g = 0; palette_8bpp[i].b = 0; + #else + drm_palette[0][i] = 0; + drm_palette[1][i] = 0; + drm_palette[2][i] = 0; + #endif } } @@ -1010,38 +980,36 @@ int main (int argc, char *argv[]) // Loop until the user closes the window while (!quit) { - // Execute frame(s) - system_frame(0); - - // Refresh video data - video_update(); - - // Output audio - Sound_Update(); - - if (selectpressed == 1) - { - Menu(); - input.system &= (IS_GG) ? ~INPUT_START : ~INPUT_PAUSE; - selectpressed = 0; - forcerefresh = 1; - } - if (SDL_PollEvent(&event)) { switch(event.type) { case SDL_KEYUP: - sdl_controls_update_input(event.key.keysym.sym, 0); + sdl_controls_update_input_release(event.key.keysym.sym); break; case SDL_KEYDOWN: - sdl_controls_update_input(event.key.keysym.sym, 1); + if (event.key.keysym.sym == SDLK_ESCAPE) + { + Menu(); + input.system &= (IS_GG) ? ~INPUT_START : ~INPUT_PAUSE; + forcerefresh = 1; + } + sdl_controls_update_input_down(event.key.keysym.sym); break; case SDL_QUIT: quit = 1; break; } } + + // Execute frame(s) + system_frame(0); + + // Refresh sound data + Sound_Update(snd.output, snd.sample_count); + + // Refresh video data + video_update(); } config_save(); diff --git a/source/ports/sdl/smsplus.c b/source/ports/sdl/smsplus.c index dddd3c9..0ed2379 100644 --- a/source/ports/sdl/smsplus.c +++ b/source/ports/sdl/smsplus.c @@ -38,6 +38,9 @@ static const uint32_t upscalers_available = 1 +1 #endif ; +uint16_t real_FPS; +Uint32 start; + static void video_update(void) { @@ -102,7 +105,9 @@ static void video_update(void) } SDL_UnlockSurface(sdl_screen); } + SDL_Flip(sdl_screen); + if(real_FPS > SDL_GetTicks()-start) SDL_Delay(real_FPS-(SDL_GetTicks()-start)); } void smsp_state(uint8_t slot_number, uint8_t mode) @@ -699,7 +704,6 @@ int main (int argc, char *argv[]) bitmap.width = VIDEO_WIDTH_SMS; bitmap.height = VIDEO_HEIGHT_SMS; bitmap.depth = 16; - bitmap.granularity = 2; bitmap.data = (uint8_t *)sms_bitmap->pixels; bitmap.pitch = sms_bitmap->pitch; bitmap.viewport.w = VIDEO_WIDTH_SMS; @@ -713,25 +717,23 @@ int main (int argc, char *argv[]) sms.use_fm = 1; } + if (sms.display == DISPLAY_PAL) real_FPS = 1000 / 50; + else real_FPS = 1000 / 60; + + printf("sms.display %d, PAL is %d\n", sms.display, DISPLAY_PAL); + bios_init(); - Sound_Init(); - // Initialize all systems and power on system_poweron(); + + Sound_Init(); // Loop until the user closes the window while (!quit) { - // Execute frame(s) - system_frame(0); + start = SDL_GetTicks(); - // Refresh video data - video_update(); - - // Output audio - Sound_Update(); - if (selectpressed == 1) { Menu(); @@ -755,6 +757,15 @@ int main (int argc, char *argv[]) break; } } + + // Execute frame(s) + system_frame(0); + + // Refresh sound data + Sound_Update(snd.output, snd.sample_count); + + // Refresh video data + video_update(); } config_save(); diff --git a/source/ports/zipit/smsplus.c b/source/ports/zipit/smsplus.c index b3a9947..1f93a0d 100644 --- a/source/ports/zipit/smsplus.c +++ b/source/ports/zipit/smsplus.c @@ -626,7 +626,6 @@ int main (int argc, char *argv[]) bitmap.width = VIDEO_WIDTH_SMS; bitmap.height = VIDEO_HEIGHT_SMS; bitmap.depth = 16; - bitmap.granularity = 2; bitmap.data = (uint8_t *)sms_bitmap->pixels; bitmap.pitch = sms_bitmap->pitch; bitmap.viewport.w = VIDEO_WIDTH_SMS; @@ -649,11 +648,11 @@ int main (int argc, char *argv[]) // Execute frame(s) system_frame(0); + // Refresh sound data + Sound_Update(snd.output, snd.sample_count); + // Refresh video data video_update(); - - // Output audio - Sound_Update(); if (selectpressed == 1) { diff --git a/source/render.c b/source/render.c index b347a3f..464a044 100644 --- a/source/render.c +++ b/source/render.c @@ -401,7 +401,6 @@ void render_line(int32_t line) /* Sprites are still processed offscreen */ if ((vdp.mode > 7) && (vdp.reg[1] & 0x40)) render_obj(line); - /* Line is only displayed where overscan is emulated */ view = 0; } diff --git a/source/scalers/scaler.c b/source/scalers/scaler.c index 8eb93ec..b29eb73 100644 --- a/source/scalers/scaler.c +++ b/source/scalers/scaler.c @@ -63,7 +63,7 @@ void upscale_160x144_to_240x160(uint16_t* restrict src, uint16_t* restrict dst){ uint16_t c[3][10]; //stretch 2px to 3px(horizonal) for(int i=0; i<10; i++){ - uint16_t r0,r1,g0,g1,b1,b2; + uint16_t r0,g0,g1,b1; c[0][i] = buffer_mem[x + i * 256]; r0 = buffer_mem[x + i * 256] & RMASK; g0 = buffer_mem[x + i * 256] & GMASK; diff --git a/source/sound/sound.c b/source/sound/sound.c index a0d5e1c..bf1a08c 100644 --- a/source/sound/sound.c +++ b/source/sound/sound.c @@ -126,10 +126,9 @@ uint32_t SMSPLUS_sound_init(void) } /* Allocate sound output streams */ - snd.output[0] = malloc(snd.buffer_size); - snd.output[1] = malloc(snd.buffer_size); + snd.output = malloc(snd.buffer_size*2); - if(!snd.output[0] || !snd.output[1]) + if(!snd.output) return 0; /* Set up buffer pointers */ @@ -187,13 +186,10 @@ void SMSPLUS_sound_shutdown(void) } /* Free sound output buffers */ - for(i = 0; i < 2; i++) + if(snd.output) { - if(snd.output[i]) - { - free(snd.output[i]); - snd.output[i] = NULL; - } + free(snd.output); + snd.output = NULL; } /* Free sample buffer position table if previously allocated */ @@ -288,14 +284,14 @@ void SMSPLUS_sound_update(int32_t line) } /* Generic FM+PSG stereo mixer callback */ -void SMSPLUS_sound_mixer_callback(int16_t **output, int32_t length) +void SMSPLUS_sound_mixer_callback(int16_t *output, int32_t length) { int32_t i; for(i = 0; i < length; i++) { int16_t temp = (fm_buffer[0][i] + fm_buffer[1][i]) / 2; - output[0][i] = temp + psg_buffer[0][i]; - output[1][i] = temp + psg_buffer[1][i]; + output[i * 2] = temp + psg_buffer[0][i]; + output[i * 2 + 1] = temp + psg_buffer[1][i]; } } diff --git a/source/sound/sound.h b/source/sound/sound.h index d9b9e09..1e137a1 100644 --- a/source/sound/sound.h +++ b/source/sound/sound.h @@ -36,8 +36,8 @@ enum { /* Sound emulation structure */ typedef struct { - void (*mixer_callback)(int16_t **output, int32_t length); - int16_t *output[2]; + void (*mixer_callback)(int16_t *output, int32_t length); + int16_t *output; int16_t *stream[STREAM_MAX]; int32_t fm_which; int32_t enabled; @@ -64,6 +64,6 @@ uint32_t SMSPLUS_sound_init(void); void SMSPLUS_sound_shutdown(void); void SMSPLUS_sound_reset(void); void SMSPLUS_sound_update(int32_t line); -void SMSPLUS_sound_mixer_callback(int16_t **output, int32_t length); +void SMSPLUS_sound_mixer_callback(int16_t *output, int32_t length); #endif /* SOUND_H_ */ diff --git a/source/sound_output/alsa/sound_output_alsa.c b/source/sound_output/alsa/sound_output_alsa.c index 241281c..86c5239 100644 --- a/source/sound_output/alsa/sound_output_alsa.c +++ b/source/sound_output/alsa/sound_output_alsa.c @@ -12,7 +12,6 @@ #include "shared.h" static snd_pcm_t *handle; -static int16_t buffer_snd[SOUND_FREQUENCY * 2]; void Sound_Init(void) { @@ -21,8 +20,6 @@ void Sound_Init(void) int32_t dir = -1; snd_pcm_uframes_t frames; - option.sndrate = SOUND_FREQUENCY; - /* Open PCM device for playback. */ int32_t rc = snd_pcm_open(&handle, "default", SND_PCM_STREAM_PLAYBACK, 0); @@ -51,6 +48,8 @@ void Sound_Init(void) #ifdef NONBLOCKING_AUDIO snd_pcm_nonblock(handle, 1); +#else + snd_pcm_nonblock(handle, 0); #endif /* Allocate a hardware parameters object. */ @@ -90,7 +89,7 @@ void Sound_Init(void) return; } - val = SOUND_FREQUENCY; + val = snd.sample_rate; rc=snd_pcm_hw_params_set_rate_near(handle, params, &val, &dir); if (rc < 0) { @@ -99,7 +98,7 @@ void Sound_Init(void) } /* Set period size to settings.aica.BufferSize frames. */ - frames = SOUND_SAMPLES_SIZE; + frames = snd.buffer_size; rc = snd_pcm_hw_params_set_period_size_near(handle, params, &frames, &dir); if (rc < 0) { @@ -121,29 +120,20 @@ void Sound_Init(void) fprintf(stderr, "Unable to set hw parameters: %s\n", snd_strerror(rc)); return; } + return; } -void Sound_Update(void) +void Sound_Update(int16_t* sound_buffer, unsigned long len) { - uint32_t i; - long len = SOUND_FREQUENCY / snd.fps, ret; - - if (!handle) return; - - for (i = 0; i < (SOUND_FREQUENCY / snd.fps); i++) - { - buffer_snd[i * 2] = snd.output[1][i] * option.soundlevel; - buffer_snd[i * 2 + 1] = snd.output[0][i] * option.soundlevel; - } - - ret = snd_pcm_writei(handle, buffer_snd, len); + long ret; + ret = snd_pcm_writei(handle, sound_buffer, len); while(ret != len) { if (ret < 0) snd_pcm_prepare( handle ); else len -= ret; - ret = snd_pcm_writei(handle, buffer_snd, len); + ret = snd_pcm_writei(handle, sound_buffer, len); } } diff --git a/source/sound_output/libao/sound_libao.c b/source/sound_output/libao/sound_libao.c index 945fe37..6eaeaad 100644 --- a/source/sound_output/libao/sound_libao.c +++ b/source/sound_output/libao/sound_libao.c @@ -14,7 +14,6 @@ static ao_device *aodevice; static ao_sample_format aoformat; -static int16_t buffer_snd[SOUND_FREQUENCY * 2]; void Sound_Init() { @@ -23,25 +22,17 @@ void Sound_Init() aoformat.bits = 16; aoformat.channels = 2; - aoformat.rate = SOUND_FREQUENCY; + aoformat.rate = option.sndrate; aoformat.byte_format = AO_FMT_LITTLE; - option.sndrate = SOUND_FREQUENCY; aodevice = ao_open_live(ao_default_driver_id(), &aoformat, NULL); // Live output if (!aodevice) aodevice = ao_open_live(ao_driver_id("null"), &aoformat, NULL); } -void Sound_Update() +void Sound_Update(int16_t* sound_buffer, unsigned long len) { - int32_t i; - - for (i = 0; i < (SOUND_FREQUENCY / snd.fps); i++) - { - buffer_snd[i * 2] = snd.output[1][i] * option.soundlevel; - buffer_snd[i * 2 + 1] = snd.output[0][i] * option.soundlevel; - } - ao_play(aodevice, (char*)buffer_snd, SOUND_FREQUENCY / snd.fps); + ao_play(aodevice, (char*)sound_buffer, len); } void Sound_Close() diff --git a/source/sound_output/oss/sound_output_oss.c b/source/sound_output/oss/sound_output_oss.c index 0f32385..aea6351 100644 --- a/source/sound_output/oss/sound_output_oss.c +++ b/source/sound_output/oss/sound_output_oss.c @@ -15,19 +15,16 @@ #include "shared.h" static int32_t oss_audio_fd = -1; -static int16_t buffer_snd[SOUND_FREQUENCY * 2]; void Sound_Init() { uint32_t channels = 2; uint32_t format = AFMT_S16_LE; - uint32_t tmp = SOUND_FREQUENCY; int32_t err_ret; - option.sndrate = SOUND_FREQUENCY; + tmp = option.sndrate; oss_audio_fd = open("/dev/dsp", O_WRONLY - /* Probably shouldn't be used now ? */ #ifdef NONBLOCKING_AUDIO | O_NONBLOCK #endif @@ -60,18 +57,10 @@ void Sound_Init() return; } -void Sound_Update() +void Sound_Update(int16_t* sound_buffer, unsigned long len) { - int32_t i; - if (!oss_audio_fd) return; - - for (i = 0; i < (SOUND_FREQUENCY / snd.fps); i++) - { - buffer_snd[i * 2] = snd.output[1][i] * option.soundlevel; - buffer_snd[i * 2 + 1] = snd.output[0][i] * option.soundlevel; - } - write(oss_audio_fd, buffer_snd, 4 * (SOUND_FREQUENCY / snd.fps) ); + write(oss_audio_fd, sound_buffer, len); } void Sound_Close() diff --git a/source/sound_output/portaudio/sound_portaudio.c b/source/sound_output/portaudio/sound_portaudio.c index 8355439..2ae5f12 100644 --- a/source/sound_output/portaudio/sound_portaudio.c +++ b/source/sound_output/portaudio/sound_portaudio.c @@ -13,7 +13,6 @@ #include "shared.h" PaStream *apu_stream; -static int16_t buffer_snd[SOUND_FREQUENCY * 2]; #ifdef NONBLOCKING_AUDIO static int patestCallback( const void *inputBuffer, void *outputBuffer, @@ -23,15 +22,8 @@ static int patestCallback( const void *inputBuffer, void *outputBuffer, void *userData ) { /* Cast data passed through stream to our structure. */ - uint16_t *out = (uint16_t*)outputBuffer; - int32_t i; + uint16_t *out = (uint16_t*)snd.output; (void) inputBuffer; /* Prevent unused variable warning. */ - - for (i = 0; i < ( (SOUND_FREQUENCY / snd.fps)); i++) - { - out[i * 2] = snd.output[1][i] * option.soundlevel; - out[i * 2 + 1] = snd.output[0][i] * option.soundlevel; - } return 0; } @@ -43,9 +35,7 @@ void Sound_Init() err = Pa_Initialize(); PaStreamParameters outputParameters; - - option.sndrate = SOUND_FREQUENCY; - + outputParameters.device = Pa_GetDefaultOutputDevice(); if (outputParameters.device == paNoDevice) @@ -59,7 +49,7 @@ void Sound_Init() //outputParameters.suggestedLatency = Pa_GetDeviceInfo( outputParameters.device )->defaultLowOutputLatency; outputParameters.hostApiSpecificStreamInfo = NULL; - err = Pa_OpenStream( &apu_stream, NULL, &outputParameters, SOUND_FREQUENCY, SOUND_SAMPLES_SIZE, paNoFlag, + err = Pa_OpenStream( &apu_stream, NULL, &outputParameters, option.sndrate, snd.buffer_size, paNoFlag, #ifdef NONBLOCKING_AUDIO patestCallback, NULL); #else @@ -68,16 +58,10 @@ void Sound_Init() err = Pa_StartStream( apu_stream ); } -void Sound_Update() +void Sound_Update(int16_t* sound_buffer, unsigned long len) { #ifndef NONBLOCKING_AUDIO - int32_t i; - for (i = 0; i < (SOUND_FREQUENCY / snd.fps); i++) - { - buffer_snd[i * 2] = snd.output[1][i] * option.soundlevel; - buffer_snd[i * 2 + 1] = snd.output[0][i] * option.soundlevel; - } - Pa_WriteStream( apu_stream, buffer_snd, SOUND_FREQUENCY / snd.fps ); + Pa_WriteStream( apu_stream, sound_buffer, len); #endif } diff --git a/source/sound_output/pulse/sound_output_pulse.c b/source/sound_output/pulse/sound_output_pulse.c index fb3cf95..bb248e1 100644 --- a/source/sound_output/pulse/sound_output_pulse.c +++ b/source/sound_output/pulse/sound_output_pulse.c @@ -15,16 +15,13 @@ #include "shared.h" static pa_simple *pulse_stream; -static int16_t buffer_snd[SOUND_FREQUENCY * 2]; void Sound_Init() { pa_sample_spec ss; ss.format = PA_SAMPLE_S16LE; ss.channels = 2; - ss.rate = SOUND_FREQUENCY; - - option.sndrate = SOUND_FREQUENCY; + ss.rate = option.sndrate; /* Create a new playback stream */ pulse_stream = pa_simple_new(NULL, "smsplusgx", PA_STREAM_PLAYBACK, NULL, "smsplusgx", &ss, NULL, NULL, NULL); @@ -35,16 +32,9 @@ void Sound_Init() return; } -void Sound_Update() +void Sound_Update(int16_t* sound_buffer, unsigned long len) { - size_t i; - size_t len = (SOUND_FREQUENCY / snd.fps); - for (i = 0; i < len; i++) - { - buffer_snd[i * 2] = snd.output[1][i] * option.soundlevel; - buffer_snd[i * 2 + 1] = snd.output[0][i] * option.soundlevel; - } - if (pa_simple_write(pulse_stream, buffer_snd, len * 4, NULL) < 0) + if (pa_simple_write(pulse_stream, sound_buffer, len, NULL) < 0) { fprintf(stderr, "PulseAudio: pa_simple_write() failed!\n"); } diff --git a/source/sound_output/sdl12/sound_output_sdl.c b/source/sound_output/sdl12/sound_output_sdl.c index aa61d74..03ddd1b 100644 --- a/source/sound_output/sdl12/sound_output_sdl.c +++ b/source/sound_output/sdl12/sound_output_sdl.c @@ -7,9 +7,8 @@ /* Most of the sound code was taken from FBA-SDL by DmitrySmagin so many thanks to him ! */ -static int16_t buffer_snd[SOUND_FREQUENCY * 2]; -SDL_mutex *sound_mutex; -SDL_cond *sound_cv; +static SDL_mutex *sound_mutex; +static SDL_cond *sound_cv; /* Using Mutexes by default but allowing disabling them on compilation */ #ifdef SDLAUDIO_NOMUTEXES @@ -24,7 +23,7 @@ static uint32_t buf_read_pos = 0; static uint32_t buf_write_pos = 0; static int32_t buffered_bytes = 0; -static int32_t sdl_write_buffer_m(uint8_t* data, int32_t len) +static int32_t sdl_write_buffer_m(uint8_t* data, unsigned long len) { SDL_LockMutex(sound_mutex); for(uint8_t i = 0; i < len; i += 4) @@ -92,9 +91,8 @@ void sdl_callback(void *unused, uint8_t *stream, int32_t len) void Sound_Init() { SDL_AudioSpec aspec, obtained; - option.sndrate = SOUND_FREQUENCY; - BUFFSIZE = SOUND_SAMPLES_SIZE * 2 * 2 * 8; + BUFFSIZE = snd.buffer_size * 2 * 2 * 8; buffer = (uint8_t *) malloc(BUFFSIZE); /* Add some silence to the buffer */ @@ -102,10 +100,10 @@ void Sound_Init() buf_read_pos = 0; buf_write_pos = 0; - aspec.format = AUDIO_S16; - aspec.freq = SOUND_FREQUENCY; + aspec.format = AUDIO_S16SYS; + aspec.freq = option.sndrate; aspec.channels = 2; - aspec.samples = SOUND_SAMPLES_SIZE; + aspec.samples = snd.buffer_size; aspec.callback = (mutex ? sdl_callback_m : sdl_callback); aspec.userdata = NULL; @@ -135,17 +133,10 @@ void Sound_Init() return; } -void Sound_Update() +void Sound_Update(int16_t* sound_buffer, unsigned long len) { - int32_t i; - for (i = 0; i < (SOUND_FREQUENCY / snd.fps); i++) - { - buffer_snd[i * 2] = snd.output[1][i] * option.soundlevel; - buffer_snd[i * 2 + 1] = snd.output[0][i] * option.soundlevel; - } - SDL_LockAudio(); - sdl_write_buffer((int16_t*)buffer_snd, (SOUND_FREQUENCY / snd.fps)); + sdl_write_buffer(sound_buffer, len); SDL_UnlockAudio(); } diff --git a/source/sound_output/sound_output.h b/source/sound_output/sound_output.h index e21f786..ab60487 100644 --- a/source/sound_output/sound_output.h +++ b/source/sound_output/sound_output.h @@ -1,8 +1,11 @@ #ifndef SOUND_OUTPUT_H #define SOUND_OUTPUT_H +#include + extern void Sound_Init(void); -extern void Sound_Update(void); +//extern void Sound_Update(void); +extern void Sound_Update(int16_t* sound_buffer, unsigned long len); extern void Sound_Close(void); #endif diff --git a/source/state.c b/source/state.c index 3924165..216a1a8 100644 --- a/source/state.c +++ b/source/state.c @@ -144,6 +144,6 @@ void system_load_state(FILE* fd) } /* Restore palette */ - for(uint32_t i = 0; i < PALETTE_SIZE; i++) + for(int32_t i = 0; i < PALETTE_SIZE; i++) palette_sync(i); } diff --git a/source/system.h b/source/system.h index fcb03f3..c7fbc7e 100644 --- a/source/system.h +++ b/source/system.h @@ -82,7 +82,6 @@ typedef struct uint32_t height; uint32_t pitch; uint32_t depth; - uint32_t granularity; struct { int32_t x, y, w, h; diff --git a/source/text/fb/font_drawing.c b/source/text/fb/font_drawing.c index ca85e22..a25a219 100644 --- a/source/text/fb/font_drawing.c +++ b/source/text/fb/font_drawing.c @@ -91,11 +91,11 @@ static void drawChar(uint16_t* restrict buffer, int32_t *x, int32_t *y, int32_t { if((charSprite[i] >> j) & 1) { - setPixel(buffer, *x + (7 - j), *y + i, fc); + setPixel(buffer, *x + (7 - j), *y + i, fc) } else if(isOutlinePixel(charSprite, 7 - j, i)) { - setPixel(buffer, *x + (7 - j), *y + i, olc); + setPixel(buffer, *x + (7 - j), *y + i, olc) } } } diff --git a/source/tms.c b/source/tms.c index 69891bb..4ed4fbd 100644 --- a/source/tms.c +++ b/source/tms.c @@ -309,23 +309,12 @@ void make_tms_tables(void) uint8_t bs = (bx & 0x40); // uint8_t bt = (bd == 0) ? 1 : 0; uint8_t sd = (sx & 0x0F); -// uint8_t st = (sd == 0) ? 1 : 0; // opaque sprite pixel, choose 2nd pal and set sprite marker if(sd && !bs) - { tms_obj_lut[(sx<<8)|(bx)] = sd | 0x10 | 0x40; - } else - if(sd && bs) - { - // writing over a sprite - tms_obj_lut[(sx<<8)|(bx)] = bx; - } - else - { - tms_obj_lut[(sx<<8)|(bx)] = bx; - } + tms_obj_lut[(sx<<8)|(bx)] = bx; } } diff --git a/source/unzip/unzip.c b/source/unzip/unzip.c index c77d3c5..f649f59 100644 --- a/source/unzip/unzip.c +++ b/source/unzip/unzip.c @@ -1039,8 +1039,6 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file, /* ZIP64 extra fields */ if (headerId == 0x0001) { - uLong uL; - if(file_info.uncompressed_size == MAXU32) { if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.uncompressed_size) != UNZ_OK)