Problems building snes9xTYL 0.4.2me from source

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
astfgl
Posts: 1
Joined: Fri Jul 13, 2007 5:59 am

Problems building snes9xTYL 0.4.2me from source

Post by astfgl »

Hello everybody,
I'm trying to build snes9xTYL 0.4.2me from source on MacOS X (10.4.10) with the PSPSDK ('psp-gcc -v' says 4.1.0). The precompiled version runs fine on my 3.40-A OE PSP and I just replaced the eboot to run the one I compiled.

I had to make a few changes to get it to compile (IMHO Mostly caused by not using cygwin, but a real *NIX) and it does now without any errormessages. It even starts, but once I choose a game it simply crahes with that BSOD:
Exception - Bus Error (data)
EPC - 08A08F3C
Cause - 1000001C
Status - 60008613
BadVAddr - 81810860
If someone want's to read the full dump: I took a shoot.
(btw: is there a better way than taking a camera - can I dump this into a file? The OE-screenshot-module didn't work...)

Using psp-addr2line I found the error occured in line 516 of the file tile_psp.cpp (I put a copy here), which seems to handle the "psp-accelerated"-graphicsmode. Having found that I switched to softwaremode, and found everything running - though slower, as of the nature of softwaremode.

I did some experiments then:
I started with sw-mode and then switched to psp-mode. Doing that I found there are several very similar functions in tile_psp.cpp (all named: pspDraw*Tile16) and the program crashes always in one of these on the second line:

Code: Select all

cache_ptr=tile_insert_cache(current_bitshift,TileKey);

u=&#40;cache_ptr->text_idx&63&#41;<<3; //here's the crash
v=&#40;cache_ptr->text_idx>>6&#41;<<3;
I then had a look at tile_insert_cache() which is in the same file on line 154...

Code: Select all

// insert a new tile in cache

INLINE tile_cache_t *tile_insert_cache&#40;int cache_num,u32 key&#41;&#123;	
	tile_cache_t *p=tile_cache_ptr&#91;cache_num&#93;&#91;key&TILE_HASH_MASK&#93;;
	tile_cache_t *q;

	//get first free cache entry
	q=tile_cache_first_free&#91;cache_num&#93;;		
	if &#40;!q&#41; &#123;//error cache full		

		//debug_log&#40;"**tile cache full!"&#41;;
		return NULL; 
	&#125;
	tile_cached&#91;cache_num&#93;++;

	//tile_cached_line&#91;cache_num&#93;&#91;key&#93;++;
	//update first free
tile_cache_first_free&#91;cache_num&#93;=tile_cache_first_free&#91;cache_num&#93;->next;	

	//update new cached tile data
	q->next=NULL;
	q->key=key;
	q->used=render_timestamp;
	if &#40;!p&#41; &#123;//insert first	
		tile_cache_ptr&#91;cache_num&#93;&#91;key&TILE_HASH_MASK&#93;=q;
	&#125;else&#123;//insert at end
		for &#40;;;&#41;&#123;
			if &#40;p->next&#41; p=p->next;
			else &#123;p->next=q;break;&#125;
		&#125;
	&#125;
	return q;
&#125;
...and tend to think that the problem is, that the U=-call tries to derefence the pointer after the function before ran through the part marked with: debug_log("**tile cache full!"); which puts it to NULL.
(I assume that because I found a thread where someone says that cause: 1000001C means "dereferencition of a NULL-pointer". Is there a list of causes somewhere around?)


I suppose the developer did compile it as is (I already asked in his forum but didn't get an answer) - and something has been changed in the SDK. So if anybody with greater knowledge than mine could point me to what this might be, would be great!

Thanks in advance...
Post Reply