From 7a636ac01f8e8bd898381d1b2273eeacb044e654 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20Luis=20Rodr=C3=ADguez=20Gonz=C3=A1lez?= Date: Thu, 8 Jul 2021 21:01:10 +0200 Subject: [PATCH] Fixes for OD Beta --- .gitignore | 1 + Makefile.dingux | 11 +++--- build.sh | 2 +- clean.sh | 2 +- src/sdl-dingux/gui_main.cpp | 44 +++++++++++----------- src/sdl-dingux/sdl_menu.cpp | 67 +++++++++++++++++---------------- src/sdl-dingux/sdl_progress.cpp | 2 + src/sdl-dingux/sdl_video.cpp | 3 +- 8 files changed, 69 insertions(+), 63 deletions(-) diff --git a/.gitignore b/.gitignore index 1bf1d26e4..8a9e4c83c 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ src/dep/generated bin/fbasdl.dge bin/fba.opk bin/fba_ui_only.opk +nbproject/ diff --git a/Makefile.dingux b/Makefile.dingux index c9d9540ba..2aa302bb0 100644 --- a/Makefile.dingux +++ b/Makefile.dingux @@ -200,7 +200,6 @@ depobj += \ ioapi.o unzip.o dat.o state.o zipfn.o \ \ gui_config.o gui_gfx.o gui_main.o gui_romlist.o gui_setpath.o \ - gui_language_pack.o \ \ interface.o lowpass2.o \ \ @@ -322,15 +321,15 @@ alldep = $(foreach file,$(autobj:.o=.c), \ HOSTCC = gcc HOSTCXX = g++ -CC = /opt/gcw0-toolchain/usr/bin/mipsel-gcw0-linux-uclibc-gcc -CXX = /opt/gcw0-toolchain/usr/bin/mipsel-gcw0-linux-uclibc-g++ +CC = /opt/opendingux-toolchain/usr/bin/mipsel-gcw0-linux-uclibc-gcc +CXX = /opt/opendingux-toolchain/usr/bin/mipsel-gcw0-linux-uclibc-g++ LD = $(CXX) -AS = /opt/gcw0-toolchain/usr/bin/mipsel-gcw0-linux-uclibc-as +AS = /opt/opendingux-toolchain/usr/bin/mipsel-gcw0-linux-uclibc-as HOSTCFLAGS = $(incdir) -CFLAGS = -O2 -G0 -mips32r2 -pipe -fno-builtin -fno-common -mno-shared -ffast-math \ +CFLAGS = -O3 -G0 -mips32r2 -pipe -fno-builtin -fno-common -mno-shared -ffast-math \ -fomit-frame-pointer -fexpensive-optimizations -Wno-write-strings -DLSB_FIRST -CXXFLAGS = -std=gnu++11 -O2 -G0 -mips32r2 -pipe -fno-builtin -fno-common -mno-shared -ffast-math \ +CXXFLAGS = -std=gnu++11 -O3 -G0 -mips32r2 -pipe -fno-builtin -fno-common -mno-shared -ffast-math \ -fomit-frame-pointer -fexpensive-optimizations -Wno-write-strings -DLSB_FIRST CFLAGS += -D__cdecl="" -D__fastcall="" -Wno-narrowing diff --git a/build.sh b/build.sh index 70b2abccc..700fe849a 100755 --- a/build.sh +++ b/build.sh @@ -1,6 +1,6 @@ #!/bin/bash SAVEDPATH=$PATH -export PATH=/opt/gcw0-toolchain/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/bin:/opt/gcw0-toolchain/usr/bin:/opt/gcw0-toolchain/usr/sbin:$PATH +export PATH=/opt/opendingux-toolchain/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/bin:/opt/opendingux-toolchain/usr/bin:/opt/opendingux-toolchain/usr/sbin:$PATH make -f Makefile.dingux && pushd ./bin && ./make_opk.sh && popd export PATH=$SAVEDPATH diff --git a/clean.sh b/clean.sh index 83b32acc9..e86dbdd57 100755 --- a/clean.sh +++ b/clean.sh @@ -1,7 +1,7 @@ #!/bin/bash SAVEDPATH=$PATH -export PATH=/opt/gcw0-toolchain/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/bin:/opt/gcw0-toolchain/usr/bin:/opt/gcw0-toolchain/usr/sbin:$PATH +export PATH=/opt/opendingux-toolchain/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/bin:/opt/opendingux-toolchain/usr/bin:/opt/opendingux-toolchain/usr/sbin:$PATH make -f Makefile.dingux clean rm -f bin/fbasdl.dge export PATH=$SAVEDPATH diff --git a/src/sdl-dingux/gui_main.cpp b/src/sdl-dingux/gui_main.cpp index 72ab50bbb..e276267bc 100644 --- a/src/sdl-dingux/gui_main.cpp +++ b/src/sdl-dingux/gui_main.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -248,7 +249,7 @@ void lang_put_stringM( uint32_t romID, unsigned int pos_x, unsigned int pos_y, u if(romID>=nBurnDrvCount || pos_x<0 || pos_y<0 || !idx2RGBAcolor.count(coloridx)) return; - lang_DrawString( romID, (uint32_t *)lang_fontsurf->pixels, pos_x, pos_y, GUI_SCREEN_W, idx2RGBAcolor[coloridx] ); +// lang_DrawString( romID, (uint32_t *)lang_fontsurf->pixels, pos_x, pos_y, GUI_SCREEN_W, idx2RGBAcolor[coloridx] ); } static inline void lang_show_gamelist_lines() @@ -1754,7 +1755,7 @@ void ss_prog_run(void) options.rotate = 0; ConfigGameSave(); - SDL_QuitSubSystem(SDL_INIT_VIDEO); +// SDL_QuitSubSystem(SDL_INIT_VIDEO); // run emulator here RunEmulator(nBurnDrvActive); @@ -1838,14 +1839,14 @@ void set_language() gui_lang.gamelist_line_height = LINE_HEIGHT; gui_lang.gamelist_line_count = LINES_COUNT; gui_lang.gamelist_line_count_half = LINES_COUNT_HALF; - if(!use_language_pack) return; - - extern size_t pixfont_height; - if(!pixfont_height) - return; - gui_lang.gamelist_line_height = pixfont_height; - gui_lang.gamelist_line_count = (LINE_HEIGHT * LINES_COUNT+pixfont_height-1) / gui_lang.gamelist_line_height; - gui_lang.gamelist_line_count_half = gui_lang.gamelist_line_count / 2; +// if(!use_language_pack) return; +// +// extern size_t pixfont_height; +// if(!pixfont_height) +// return; +// gui_lang.gamelist_line_height = pixfont_height; +// gui_lang.gamelist_line_count = (LINE_HEIGHT * LINES_COUNT+pixfont_height-1) / gui_lang.gamelist_line_height; +// gui_lang.gamelist_line_count_half = gui_lang.gamelist_line_count / 2; } void gui_menu_main() @@ -1908,11 +1909,11 @@ void gui_menu_main() romlist_y, // y ROMLIST(longueur, fID), // length df_color? BLANC : ROMLIST(etat, fID)); // color - else - lang_put_stringM(romID, - START_X, // x - romlist_y, // y - df_color? BLANC : ROMLIST(etat, fID)); // color +// else +// lang_put_stringM(romID, +// START_X, // x +// romlist_y, // y +// df_color? BLANC : ROMLIST(etat, fID)); // color romlist_y += gui_lang.gamelist_line_height; } } else { @@ -1925,11 +1926,11 @@ void gui_menu_main() romlist_y, ROMLIST(longueur, fID), df_color? BLANC : ROMLIST(etat, fID)); - else - lang_put_stringM(romID, - START_X, // x - romlist_y, // y - df_color? BLANC : ROMLIST(etat, fID)); // color +// else +// lang_put_stringM(romID, +// START_X, // x +// romlist_y, // y +// df_color? BLANC : ROMLIST(etat, fID)); // color romlist_y += gui_lang.gamelist_line_height; } } @@ -2212,7 +2213,8 @@ void GuiRun() { // fill data with data gui_sort_romlist(); - use_language_pack = gui_load_language_pack(); + //use_language_pack = gui_load_language_pack(); + use_language_pack = false; set_language(); gui_screen = SDL_SetVideoMode(GUI_SCREEN_W, GUI_SCREEN_H, 16, SDL_SWSURFACE); diff --git a/src/sdl-dingux/sdl_menu.cpp b/src/sdl-dingux/sdl_menu.cpp index 66fb39ecd..8b2db53ca 100644 --- a/src/sdl-dingux/sdl_menu.cpp +++ b/src/sdl-dingux/sdl_menu.cpp @@ -25,8 +25,9 @@ #include #include #include -#include -#include +#include +//#include +//#include #include "version.h" #include "burner.h" @@ -99,37 +100,37 @@ static inline inGameScreen_t * CopyScreen(SDL_Surface * src) void pngsave(const char * filename, uint16_t * rgb565, int w, int h, int outw, int outh) { - if(w <= 0 || h <= 0 || !rgb565 || !filename || outw <= 0 || outh <= 0) - return; - try { - const size_t ow = outw; - const size_t oh = outh; - png::image< png::rgb_pixel,png::solid_pixel_buffer > img(ow,oh); - const int npixels = w * h; - std::vector imgu8(npixels * 3); - // We have to convert from RGB565 to RGB each coded on uint8 because PNG doesn't support RGB565 - for (int i = 0; i < npixels; ++i) { - const uint16_t v = rgb565[i]; - // Convert and rescale to the full 0-255 range - // See http://stackoverflow.com/a/29326693 - const uint8_t red5 = (v & 0xF800) >> 11; - const uint8_t green6 = (v & 0x7E0) >> 5; - const uint8_t blue5 = (v & 0x001F); - imgu8[3 * i] = ((red5 * 255 + 15) / 31); - imgu8[3 * i + 1] = ((green6 * 255 + 31) / 63); - imgu8[3 * i + 2] = ((blue5 * 255 + 15) / 31); - } - avir :: CImageResizer<> imageResizer( 8 ); - uint8_t * Inbuf = (uint8_t *)imgu8.data(); - uint8_t * Outbuf = (uint8_t *)img.get_pixbuf().get_bytes().data(); - imageResizer.resizeImage( Inbuf, w, h, 0, Outbuf, ow, oh, 3, 0 ); - img.write(filename); - } - catch(std::exception const& error) - { - std::cerr << "png++ err: " << error.what() << std::endl; - return; - } +// if(w <= 0 || h <= 0 || !rgb565 || !filename || outw <= 0 || outh <= 0) +// return; +// try { +// const size_t ow = outw; +// const size_t oh = outh; +// png::image< png::rgb_pixel,png::solid_pixel_buffer > img(ow,oh); +// const int npixels = w * h; +// std::vector imgu8(npixels * 3); +// // We have to convert from RGB565 to RGB each coded on uint8 because PNG doesn't support RGB565 +// for (int i = 0; i < npixels; ++i) { +// const uint16_t v = rgb565[i]; +// // Convert and rescale to the full 0-255 range +// // See http://stackoverflow.com/a/29326693 +// const uint8_t red5 = (v & 0xF800) >> 11; +// const uint8_t green6 = (v & 0x7E0) >> 5; +// const uint8_t blue5 = (v & 0x001F); +// imgu8[3 * i] = ((red5 * 255 + 15) / 31); +// imgu8[3 * i + 1] = ((green6 * 255 + 31) / 63); +// imgu8[3 * i + 2] = ((blue5 * 255 + 15) / 31); +// } +// avir :: CImageResizer<> imageResizer( 8 ); +// uint8_t * Inbuf = (uint8_t *)imgu8.data(); +// uint8_t * Outbuf = (uint8_t *)img.get_pixbuf().get_bytes().data(); +// imageResizer.resizeImage( Inbuf, w, h, 0, Outbuf, ow, oh, 3, 0 ); +// img.write(filename); +// } +// catch(std::exception const& error) +// { +// std::cerr << "png++ err: " << error.what() << std::endl; +// return; +// } } #define SP_SCREEN_W 320 diff --git a/src/sdl-dingux/sdl_progress.cpp b/src/sdl-dingux/sdl_progress.cpp index ccc766f7a..641f17744 100644 --- a/src/sdl-dingux/sdl_progress.cpp +++ b/src/sdl-dingux/sdl_progress.cpp @@ -94,6 +94,7 @@ int ProgressCreate() DrawString("Based on FinalBurnAlpha", (uint16 *)load_screen->pixels, 10, 35, fwidth); DrawString("Now loading ... ", (uint16 *)load_screen->pixels, 10, 105, fwidth); show_rom_loading_text("Open Zip", 0, 0); + return 0; } int ProgressDestroy() @@ -102,6 +103,7 @@ int ProgressDestroy() SDL_FreeSurface(load_screen); load_screen = NULL; } + return 0; } int ProgressUpdateBurner(double dProgress, const TCHAR* pszText, bool bAbs) diff --git a/src/sdl-dingux/sdl_video.cpp b/src/sdl-dingux/sdl_video.cpp index 3157d33f8..3cbe01e49 100644 --- a/src/sdl-dingux/sdl_video.cpp +++ b/src/sdl-dingux/sdl_video.cpp @@ -2065,7 +2065,8 @@ void VideoExit() free(BurnVideoBuffer); BurnVideoBuffer = NULL; BurnerVideoTrans = Blit_null; - SDL_QuitSubSystem(SDL_INIT_VIDEO); + SDL_FreeSurface(screen); +// SDL_QuitSubSystem(SDL_INIT_VIDEO); } void VideoClear()