Skip to content

Commit

Permalink
Fixes for OD Beta
Browse files Browse the repository at this point in the history
  • Loading branch information
plrguez committed Jul 8, 2021
1 parent 5fbce9e commit 7a636ac
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 63 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ src/dep/generated
bin/fbasdl.dge
bin/fba.opk
bin/fba_ui_only.opk
nbproject/
11 changes: 5 additions & 6 deletions Makefile.dingux
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
\
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion clean.sh
Original file line number Diff line number Diff line change
@@ -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
44 changes: 23 additions & 21 deletions src/sdl-dingux/gui_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <libgen.h>

#include <algorithm>
#include <map>
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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 {
Expand All @@ -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;
}
}
Expand Down Expand Up @@ -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);
Expand Down
67 changes: 34 additions & 33 deletions src/sdl-dingux/sdl_menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
#include <unistd.h>
#include <vector>
#include <fstream>
#include <avir.h>
#include <png++/png.hpp>
#include <iostream>
//#include <avir.h>
//#include <png++/png.hpp>

#include "version.h"
#include "burner.h"
Expand Down Expand Up @@ -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<png::rgb_pixel> > img(ow,oh);
const int npixels = w * h;
std::vector<uint8_t> 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<png::rgb_pixel> > img(ow,oh);
// const int npixels = w * h;
// std::vector<uint8_t> 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
Expand Down
2 changes: 2 additions & 0 deletions src/sdl-dingux/sdl_progress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -102,6 +103,7 @@ int ProgressDestroy()
SDL_FreeSurface(load_screen);
load_screen = NULL;
}
return 0;
}

int ProgressUpdateBurner(double dProgress, const TCHAR* pszText, bool bAbs)
Expand Down
3 changes: 2 additions & 1 deletion src/sdl-dingux/sdl_video.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 7a636ac

Please sign in to comment.