Skip to content

Commit

Permalink
multiple buggfixes in gb64 ui, bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
badda71 committed Jan 30, 2020
1 parent ad566ad commit f6ff52a
Show file tree
Hide file tree
Showing 8 changed files with 170 additions and 147 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ GITHASH := $(shell git rev-parse --short HEAD)

ifeq ($(VICETARGET), C64)
VERSION_MAJOR := 2
VERSION_MINOR := 1
VERSION_MINOR := 2
VERSION_MICRO := 0
else ifeq ($(VICETARGET), C128)
VERSION_MAJOR := 0
Expand Down
14 changes: 9 additions & 5 deletions source/common/arch/3ds/async_http.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,17 +124,21 @@ int async_http_get(char *url, char *fname, void (*callback)(char *url, char *fna
if (!isinit) return -1;

// check if we are already downloading this file
if (tsh_get(&async_hash, url)) {
return 0;
}
tsh_put(&async_hash, url, (void*)1);
if (tsh_get(&async_hash, url)) return 0;
if (tsh_put(&async_hash, url, (void*)1) == -1) return -1;

async_http_request *gf = malloc(sizeof(async_http_request));
gf->url=lib_stralloc(url);
gf->fname=lib_stralloc(fname);
gf->callback=callback;
gf->param=param;
tsq_put(&async_queue, gf);
gf=tsq_put(&async_queue, gf);
if (gf) { // we overwrote an existing queue entry, so clean up the old one
tsh_put(&async_hash, gf->url, NULL);
free(gf->fname);
free(gf->url);
free(gf);
}
svcReleaseSemaphore(&x, workerRequest, 1);
return 0;
}
2 changes: 1 addition & 1 deletion source/common/arch/3ds/http.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ int downloadFile(char *url,
}

curl_easy_setopt(curl, CURLOPT_BUFFERSIZE, 128 * 1024);
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 5L);
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 10L);
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_ACCEPT_ENCODING, "");
curl_easy_setopt(curl, CURLOPT_USERAGENT, "libcurl-agent/1.0");
Expand Down
21 changes: 10 additions & 11 deletions source/common/arch/3ds/uibottom.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ static Handle repaintRequired;
static volatile int help_anim;
static volatile int menu_anim=0;
static u8 *gpusrc=NULL;
static u8 *menusrc=NULL;

#define HASHSIZE 256
static tsh_object iconHash;
Expand Down Expand Up @@ -448,6 +449,7 @@ static void makeTexture(C3D_Tex *tex, u8 *mygpusrc, unsigned hw, unsigned hh) {
svcReleaseSemaphore(&i, privateSem1, 1);
}

// this function is NOT thread safe - it uses static buffer gpusrc!!
static void makeImage(DS3_Image *img, u8 *pixels, unsigned w, unsigned h, int noconv) {

img->w=w;
Expand Down Expand Up @@ -1305,7 +1307,7 @@ void menu_recalc() {
if (events_to_emu) alpha=alpha2=128;

for(y = 0; y < 240; ++y) {
dst=gpusrc+y*hw*4;
dst=menusrc+y*hw*4;
if (y==menu_alpha_max_y) alpha=0;
for (x=0; x<320; ++x) {
if (*src==0) *dst++ = alpha;// alpha
Expand All @@ -1319,12 +1321,12 @@ void menu_recalc() {

// draw white lines
for (y=0;y<230;++y) {
dst=gpusrc+y*hw*4+4*319;
dst=menusrc+y*hw*4+4*319;
*((int*)dst)=0xFFFFFFFF;
}
memset(gpusrc+239*hw*4,255,310*4);
memset(menusrc+239*hw*4,255,310*4);

makeTexture(&(menu_spr.tex), gpusrc, hw, hh);
makeTexture(&(menu_spr.tex), menusrc, hw, hh);
}

void gb64_recalc() {
Expand Down Expand Up @@ -1356,7 +1358,6 @@ void sdl_uibottom_draw(void)
keyboard_recalc();
}

// zero keypress status if we updated anything
if (uibottom_must_redraw_local & UIB_GET_RECALC_KEYPRESS) {
keypress_recalc();
}
Expand All @@ -1367,12 +1368,7 @@ void sdl_uibottom_draw(void)
if (sdl_menu_state && (uibottom_must_redraw_local & UIB_RECALC_GB64)) {
gb64_recalc();
}
/*
// check if our internal state matches the SDL state
// (actually a stupid workaround for the issue that fullscreen sbutton does not unstick)
if (!_mouse_enabled && kb_activekey != -1 && !SDL_GetMouseState(NULL, NULL))
SDL_PushEvent( &(SDL_Event){ .type = SDL_MOUSEBUTTONUP });
*/

requestRepaint();
}
}
Expand Down Expand Up @@ -1841,6 +1837,7 @@ int uibottom_resources_init() {

// init gpusrc
gpusrc = linearAlloc(512*256*4);
menusrc = linearAlloc(512*256*4);

if (resources_register_string(resources_string) < 0) {
return -1;
Expand All @@ -1861,6 +1858,8 @@ void uibottom_resources_shutdown() {

linearFree(gpusrc);
gpusrc=NULL;
linearFree(menusrc);
menusrc=NULL;

tsh_free(&iconHash);
}
Expand Down
Loading

0 comments on commit f6ff52a

Please sign in to comment.