Skip to content

Commit

Permalink
new gamebase games source / Makefile update
Browse files Browse the repository at this point in the history
  • Loading branch information
badda71 committed Feb 11, 2023
1 parent 1417787 commit 8e40483
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 16 deletions.
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ GITHASH := $(shell git rev-parse --short HEAD)
ifeq ($(VICETARGET), C64)
VERSION_MAJOR := 2
VERSION_MINOR := 4
VERSION_MICRO := 1
VERSION_MICRO := 2
else ifeq ($(VICETARGET), C128)
VERSION_MAJOR := 0
VERSION_MINOR := 2
Expand All @@ -92,16 +92,17 @@ SYSTEM_MODE_EXT := 124MB
BANNER_AUDIO := $(TOPDIR)/$(META)/audio_3ds_$(VICETARGET).wav
BANNER_IMAGE := $(TOPDIR)/$(META)/banner_3ds_$(VICETARGET).cgfx
LOGO := $(TOPDIR)/$(META)/logo-padded.lz11
FONT := $(TOPDIR)/$(META)/picopixel.ttf

ifeq (, $(shell which gm))
MKKBDPNG := cp -f
MKICOPNG := cp -f

else
MKKBDPNG := gm convert -fill white -font "Picopixel-Standard"\
MKKBDPNG := gm convert -fill white -font $(FONT)\
-draw "font-size 8;text 3,109 'vice3DS - $(VICETARGET)';"\
-draw "font-size 8;text 3,116 'v$(VERSION) by badda71';"
MKICOPNG := gm convert -fill white -font "Picopixel-Standard"\
MKICOPNG := gm convert -fill white -font $(FONT)\
-draw "font-size 8;text 1,47 'v$(VERSION)';"
endif

Expand All @@ -114,7 +115,7 @@ CFLAGS := -ggdb -Wall -Wno-stringop-truncation -Wno-format-truncation -O3 -mwor
-fomit-frame-pointer -ffunction-sections \
-ffast-math $(ARCH)

CFLAGS += $(INCLUDE) -DARM11 -D_3DS -DVERSION3DS=\"$(VERSION)\" -DGITHASH=\"$(GITHASH)\" -DTARGETNAME=\"$(TARGET)\"
CFLAGS += $(INCLUDE) -DARM11 -D_3DS -D__3DS__ -DVERSION3DS=\"$(VERSION)\" -DGITHASH=\"$(GITHASH)\" -DTARGETNAME=\"$(TARGET)\"

CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
CFLAGS += -std=gnu11
Expand Down
2 changes: 1 addition & 1 deletion VICE3DS_SDL/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ INCLUDES := $(addprefix -I,$(shell find $(SRCDIR) -type d))\
-I/opt/devkitpro/portlibs/3ds/include\
-I/opt/devkitpro/libctru/include

CFLAGS := -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft -ggdb -O3 -mword-relocations -ffunction-sections -fdata-sections -D_3DS -D_GNU_SOURCE=1 -DARM11 -Wall -ffast-math -std=gnu11
CFLAGS := -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft -ggdb -O3 -mword-relocations -ffunction-sections -fdata-sections -D_3DS -D__3DS__ -D_GNU_SOURCE=1 -DARM11 -Wall -ffast-math -std=gnu11
DEPFLAGS = -MT $@ -MMD -MP -MF $(ODIR)/$*.Td
POSTCOMPILE = @mv -f $(ODIR)/$*.Td $(ODIR)/$*.d && touch $@

Expand Down
2 changes: 1 addition & 1 deletion ZIP/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ CFLAGS := -ggdb -Wall -O3 -mword-relocations \
-fomit-frame-pointer -ffunction-sections \
$(ARCH)

CFLAGS += $(INCLUDE) -DARM11 -D_3DS -DHAVE_CONFIG_H
CFLAGS += $(INCLUDE) -DARM11 -D_3DS -D__3DS__ -DHAVE_CONFIG_H
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions

ASFLAGS := -g $(ARCH)
Expand Down
12 changes: 12 additions & 0 deletions makelinks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh
cwd=`pwd`
for i in `find source -type f -size -50c`
do
ii=`cat $i`
dir=`dirname "$i"`
fn=`basename "$i"`
cd $dir
rm -rf $fn
ln -s $ii $fn
cd $cwd
done
Binary file added meta/picopixel.ttf
Binary file not shown.
33 changes: 23 additions & 10 deletions source/common/arch/3ds/uigb64.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,14 @@
// defines
#define GB64_FIRST_Y 3
#define GB64_SS_URL "http://www.gb64.com/Screenshots/"
#define GB64_GAME_URL "ftp://8bitfiles.net/gamebase_64/Games/"
#define GB64_GAME_URL "http://badda.de/vice3ds/gb64/games/"
#define GB64_DBNAME "gb64_2.db"
#define GB64_DBGZ_BASEURL "http://badda.de/vice3ds/gb64/"

// static vars
static char *gb64_game_url = GB64_GAME_URL;
static char *gb64_ss_url = GB64_SS_URL;

typedef struct {
char *blob;
long blobsize;
Expand Down Expand Up @@ -104,7 +108,7 @@ static int pdb_initDB(picoDB *d, char *filename) {
long fsize = ftell(f);
fseek(f, 0, SEEK_SET); /* same as rewind(f); */

char *string = malloc(fsize + 1);
char *string = malloc(fsize + 2);
if (string==NULL) {
fclose(f);
log_error(LOG_DEFAULT,"Could not allocate memory for database");
Expand All @@ -115,12 +119,13 @@ static int pdb_initDB(picoDB *d, char *filename) {
if (string) free(string);*/
return -1;
}
fread(string, 1, fsize, f);
string[0]='\n';
fread(string+1, 1, fsize, f);
fclose(f);
fsize++;

// check the entries
int count=0;
if (string[0]!='/') ++count;
for (int i=0; i<fsize; i++) if (string[i]=='\n' && string[i+1]!='/') ++count;
char **entries=malloc((count+1)*sizeof(char*));
if (entries==NULL) {
Expand All @@ -129,11 +134,16 @@ static int pdb_initDB(picoDB *d, char *filename) {
return -1;
}
count=0;
if (string[0]!='/') entries[count++]=string;
for (int i=0; i<fsize; i++) {
switch (string[i]) {
case '\n':
if (string[i+1]!='/') entries[count++]=string+i+1; // skip comments
if (string[i+1]=='/') { // setting a variable: GAME_URL or SSHT_URL
if (strncmp(string+i+2, "GAME_URL", 8) == 0)
gb64_game_url = string+i+11;
else if (strncmp(string+i+2, "SSHT_URL", 8) == 0)
gb64_ss_url = string+i+11;
} else // skip comments
entries[count++]=string+i+1;
// fallthrough
case '\t':
string[i]=0;
Expand All @@ -149,6 +159,8 @@ static int pdb_initDB(picoDB *d, char *filename) {
}

static void pdb_freeDB(picoDB *d) {
gb64_game_url = GB64_GAME_URL;
gb64_ss_url = GB64_SS_URL;
if (d) {
if (d->blob) {
free(d->blob);
Expand Down Expand Up @@ -430,7 +442,7 @@ static void gb64_download(int idx) {
sdl_ui_init_progress_bar(buf2);
sdl_ui_refresh();

char *url = util_concat(GB64_GAME_URL, pdb_getEntry(&db, idx, 2), NULL);
char *url = util_concat(gb64_game_url, pdb_getEntry(&db, idx, 2), NULL);
char *fname = util_concat(archdep_xdg_data_home(), "/tmp_game.zip",NULL);

if (http_download_file(url, fname, sdl_ui_check_cancel, sdl_ui_update_progress_bar)) {
Expand Down Expand Up @@ -547,12 +559,13 @@ static void uigb64_update_topscreen(SDL_Surface *s, int entry, int *screenshotid
p=pdb_getEntry(&db, entry, 4);
char *pimg_fpath=util_concat(archdep_xdg_cache_home(), "/", p, NULL);
char *base_fname=lib_stralloc(p);
*(strrchr(base_fname,'.'))=0;
p1=strrchr(base_fname,'.');
if (p1) *p1=0;
char *base_fpath=util_concat(archdep_xdg_cache_home(), "/", base_fname, NULL);

// check primary image
if (access(pimg_fpath,R_OK) != 0) {
snprintf(url, 256, "%s%s", GB64_SS_URL, p);
snprintf(url, 256, "%s%s", gb64_ss_url, p);
async_http_get(url, pimg_fpath, uigb64_callback_imgLoad, 0);
} else numimg=1;

Expand All @@ -565,7 +578,7 @@ static void uigb64_update_topscreen(SDL_Surface *s, int entry, int *screenshotid
// check img file
snprintf(buf2, 256, "%s_%d.png", base_fpath, j);
if (access(buf2,R_OK) != 0) {
snprintf(url, 256, "%s%s_%d.png", GB64_SS_URL, base_fname, j);
snprintf(url, 256, "%s%s_%d.png", gb64_ss_url, base_fname, j);
async_http_get(url, buf2, uigb64_callback_imgLoad, (void*)j);
break;
} else numimg=j+1;
Expand Down

0 comments on commit 8e40483

Please sign in to comment.