RetroGame

移植ReGBA


ReGBA是一款比較新且針對MIPS處理器優化的GBA模擬器,運行速度還算是不錯,從GCW0掌機身上就可以印證這點,而針對Pixel操作的部分,感謝TonyJih的協助,目前運算的方式還算是不錯,詳細修改部分,如下所示:

diff -Nr old_regba/source/common.h new_regba/source/common.h
33a34
> #include <errno.h>
diff -Nr old_regba/source/dstwo/.gitignore new_regba/source/dstwo/.gitignore
1,3d0
< TEMPGBA/system/ndsgba.cfg
< TEMPGBA/gba_bios.bin
< TEMPGBA/game_config.txt
diff -Nr old_regba/source/opendingux/draw.c new_regba/source/opendingux/draw.c
43c43
< video_scale_type ScaleMode = scaled_aspect;
---
> video_scale_type ScaleMode = fullscreen;
311a312
>       //*(uint32_t*) (to + dst_pitch) = *(uint32_t*) (to);
317a319
>       //*(uint32_t*) (to + 2 + dst_pitch) = *(uint32_t*) (to + 2);
323a326
>       //*(uint32_t*) (to + 4 + dst_pitch) = *(uint32_t*) (to + 4);
329a333
>       //*(uint32_t*) (to + 6 + dst_pitch) = *(uint32_t*) (to + 6);
340c344
< 				*(uint32_t*) ((uint8_t*) to + dst_pitch) = likely(Hi(bh_ag) == Lo(bh_ag))
---
> 				*(uint32_t*) ((uint8_t*) to + (dst_pitch * 2)) = likely(Hi(bh_ag) == Lo(bh_ag))
343a348
>         //*(uint32_t*) (to + (dst_pitch * 3)) = *(uint32_t*) (to + (dst_pitch * 2));
349c354
< 				*(uint32_t*) ((uint8_t*) to + dst_pitch + 4) = likely(Hi(ci_bh) == Lo(ci_bh))
---
> 				*(uint32_t*) ((uint8_t*) to + (dst_pitch * 2) + 4) = likely(Hi(ci_bh) == Lo(ci_bh))
352a358
>         //*(uint32_t*) (to + (dst_pitch * 3) + 4) = *(uint32_t*) (to + (dst_pitch * 2) + 4);
356c362
< 				*(uint32_t*) ((uint8_t*) to + dst_pitch + 12) = likely(Hi(fl_ek) == Lo(fl_ek))
---
> 				*(uint32_t*) ((uint8_t*) to + (dst_pitch * 2) + 12) = likely(Hi(fl_ek) == Lo(fl_ek))
359a366
>         //*(uint32_t*) (to + (dst_pitch * 3) + 12) = *(uint32_t*) (to + (dst_pitch * 2) + 12);
365c372
< 				*(uint32_t*) ((uint8_t*) to + dst_pitch + 8) = likely(Hi(ek_dj) == Lo(ek_dj))
---
> 				*(uint32_t*) ((uint8_t*) to + (dst_pitch * 2) + 8) = likely(Hi(ek_dj) == Lo(ek_dj))
368a376
>         //*(uint32_t*) (to + (dst_pitch * 3) + 8) = *(uint32_t*) (to + (dst_pitch * 2) + 8);
372c380
< 				*(uint32_t*) ((uint8_t*) to + dst_pitch * 2) = likely(Hi(h_g) == Lo(h_g))
---
> 				*(uint32_t*) ((uint8_t*) to + (dst_pitch * 4)) = likely(Hi(h_g) == Lo(h_g))
375a384
>         //*(uint32_t*) (to + (dst_pitch * 5)) = *(uint32_t*) (to + (dst_pitch * 4));
378c387
< 				*(uint32_t*) ((uint8_t*) to + dst_pitch * 2 + 4) = likely(Hi(h_g) == Lo(j_i))
---
> 				*(uint32_t*) ((uint8_t*) to + (dst_pitch * 4) + 4) = likely(Hi(h_g) == Lo(j_i))
381a391
>         //*(uint32_t*) (to + (dst_pitch * 5)) = *(uint32_t*) (to + (dst_pitch * 4));
384c394
< 				*(uint32_t*) ((uint8_t*) to + dst_pitch * 2 + 8) = likely(Hi(j_i) == Lo(l_k))
---
> 				*(uint32_t*) ((uint8_t*) to + (dst_pitch * 4) + 8) = likely(Hi(j_i) == Lo(l_k))
387a398
>         //*(uint32_t*) (to + (dst_pitch * 5)) = *(uint32_t*) (to + (dst_pitch * 4));
390c401
< 				*(uint32_t*) ((uint8_t*) to + dst_pitch * 2 + 12) = likely(Hi(l_k) == Lo(l_k))
---
> 				*(uint32_t*) ((uint8_t*) to + (dst_pitch * 4) + 12) = likely(Hi(l_k) == Lo(l_k))
393a405
>         //*(uint32_t*) (to + (dst_pitch * 5)) = *(uint32_t*) (to + (dst_pitch * 4));
403c415,416
< 		to   = (uint16_t*) ((uint8_t*) to   + dst_skip + 2 * dst_pitch);
---
> 		//to   = (uint16_t*) ((uint8_t*) to   + dst_skip + 2 * dst_pitch);
> 		to   = (uint16_t*) ((uint8_t*) to   + dst_skip + (5 * dst_pitch));
640a654
> 			//*(uint16_t*) ((uint8_t*) to + (dst_pitch)) = *(uint16_t*) ((uint8_t*) to);
645a660
> 			//*(uint16_t*) ((uint8_t*) to + (dst_pitch) + 2) = *(uint16_t*) ((uint8_t*) to + 2);
650a666
> 			//*(uint16_t*) ((uint8_t*) to + (dst_pitch) + 4) = *(uint16_t*) ((uint8_t*) to + 4);
655a672
> 			//*(uint16_t*) ((uint8_t*) to + (dst_pitch) + 6) = *(uint16_t*) ((uint8_t*) to + 6);
665c682
< 			*(uint16_t*) ((uint8_t*) to + dst_pitch) = likely(a == e)
---
> 			*(uint16_t*) ((uint8_t*) to + (dst_pitch * 2)) = likely(a == e)
667a685
> 			//*(uint16_t*) ((uint8_t*) to + (dst_pitch * 3)) = *(uint16_t*) ((uint8_t*) to + (dst_pitch * 2));
676c694
< 			*(uint16_t*) ((uint8_t*) to + dst_pitch + 2) = likely(a1b3 == e1f3)
---
> 			*(uint16_t*) ((uint8_t*) to + (dst_pitch * 2) + 2) = likely(a1b3 == e1f3)
678a697
> 			//*(uint16_t*) ((uint8_t*) to + (dst_pitch * 3) + 2) = *(uint16_t*) ((uint8_t*) to + (dst_pitch * 2) + 2);
687c706
< 			*(uint16_t*) ((uint8_t*) to + dst_pitch + 4) = likely(bc == fg)
---
> 			*(uint16_t*) ((uint8_t*) to + (dst_pitch * 2) + 4) = likely(bc == fg)
689a709
> 			//*(uint16_t*) ((uint8_t*) to + (dst_pitch * 3) + 4) = *(uint16_t*) ((uint8_t*) to + (dst_pitch * 2) + 4);
698c718
< 			*(uint16_t*) ((uint8_t*) to + dst_pitch + 6) = /* in Y */ likely(g3h1 == c3d1)
---
> 			*(uint16_t*) ((uint8_t*) to + (dst_pitch * 2) + 6) = /* in Y */ likely(g3h1 == c3d1)
700a721
> 			//*(uint16_t*) ((uint8_t*) to + (dst_pitch * 3) + 6) = *(uint16_t*) ((uint8_t*) to + (dst_pitch * 2) + 6);
705c726,727
< 			*(uint16_t*) ((uint8_t*) to + dst_pitch * 2) = e;
---
> 			*(uint16_t*) ((uint8_t*) to + (dst_pitch * 4)) = e;
> 			//*(uint16_t*) ((uint8_t*) to + (dst_pitch * 5)) = *(uint16_t*) ((uint8_t*) to + (dst_pitch * 4));
708c730
< 			*(uint16_t*) ((uint8_t*) to + dst_pitch * 2 + 2) = likely(e == f)
---
> 			*(uint16_t*) ((uint8_t*) to + (dst_pitch * 4) + 2) = likely(e == f)
710a733
> 			//*(uint16_t*) ((uint8_t*) to + (dst_pitch * 5) + 2) = *(uint16_t*) ((uint8_t*) to + (dst_pitch * 4) + 2);
713c736
< 			*(uint16_t*) ((uint8_t*) to + dst_pitch * 2 + 4) = likely(f == g)
---
> 			*(uint16_t*) ((uint8_t*) to + (dst_pitch * 4) + 4) = likely(f == g)
715a739
> 			//*(uint16_t*) ((uint8_t*) to + (dst_pitch * 5) + 4) = *(uint16_t*) ((uint8_t*) to + (dst_pitch * 4) + 4);
718c742
< 			*(uint16_t*) ((uint8_t*) to + dst_pitch * 2 + 6) = likely(g == h)
---
> 			*(uint16_t*) ((uint8_t*) to + (dst_pitch * 4) + 6) = likely(g == h)
720a745
> 			//*(uint16_t*) ((uint8_t*) to + (dst_pitch * 5) + 6) = *(uint16_t*) ((uint8_t*) to + (dst_pitch * 4) + 6);
729c754
< 		to   = (uint16_t*) ((uint8_t*) to   + dst_skip + 2 * dst_pitch);
---
> 		to   = (uint16_t*) ((uint8_t*) to   + dst_skip + 5 * dst_pitch);
1256a1282
> 			//*(uint16_t*) ((uint8_t*) to + (dst_pitch)) = *(uint16_t*) ((uint8_t*) to);
1261a1288
> 			//*(uint16_t*) ((uint8_t*) to + (dst_pitch) + 2) = *(uint16_t*) ((uint8_t*) to + 2);
1266a1294
> 			//*(uint16_t*) ((uint8_t*) to + (dst_pitch) + 4) = *(uint16_t*) ((uint8_t*) to + 4);
1271a1300
> 			//*(uint16_t*) ((uint8_t*) to + (dst_pitch) + 6) = *(uint16_t*) ((uint8_t*) to + 6);
1281c1310
< 			*(uint16_t*) ((uint8_t*) to + dst_pitch) = likely(a == e)
---
> 			*(uint16_t*) ((uint8_t*) to + (dst_pitch * 2)) = likely(a == e)
1283a1313
> 			//*(uint16_t*) ((uint8_t*) to + (dst_pitch * 3)) = *(uint16_t*) ((uint8_t*) to + (dst_pitch * 2));
1292c1322
< 			*(uint16_t*) ((uint8_t*) to + dst_pitch + 2) = likely(a1b3 == e1f3)
---
> 			*(uint16_t*) ((uint8_t*) to + (dst_pitch * 2) + 2) = likely(a1b3 == e1f3)
1294a1325
> 			//*(uint16_t*) ((uint8_t*) to + (dst_pitch * 3) + 2) = *(uint16_t*) ((uint8_t*) to + (dst_pitch * 2) + 2);
1303c1334
< 			*(uint16_t*) ((uint8_t*) to + dst_pitch + 4) = likely(bc == fg)
---
> 			*(uint16_t*) ((uint8_t*) to + (dst_pitch * 2) + 4) = likely(bc == fg)
1305a1337
> 			//*(uint16_t*) ((uint8_t*) to + (dst_pitch * 3) + 4) = *(uint16_t*) ((uint8_t*) to + (dst_pitch * 2) + 4);
1314c1346
< 			*(uint16_t*) ((uint8_t*) to + dst_pitch + 6) = /* in Y */ likely(g3h1 == c3d1)
---
> 			*(uint16_t*) ((uint8_t*) to + (dst_pitch * 2) + 6) = /* in Y */ likely(g3h1 == c3d1)
1316a1349
> 			//*(uint16_t*) ((uint8_t*) to + (dst_pitch * 3) + 6) = *(uint16_t*) ((uint8_t*) to + (dst_pitch * 2) + 6);
1321c1354,1355
< 			*(uint16_t*) ((uint8_t*) to + dst_pitch * 2) = e;
---
> 			*(uint16_t*) ((uint8_t*) to + (dst_pitch * 4)) = e;
> 			//*(uint16_t*) ((uint8_t*) to + (dst_pitch * 5)) = *(uint16_t*) ((uint8_t*) to + (dst_pitch * 4));
1324c1358
< 			*(uint16_t*) ((uint8_t*) to + dst_pitch * 2 + 2) = likely(e == f)
---
> 			*(uint16_t*) ((uint8_t*) to + (dst_pitch * 4) + 2) = likely(e == f)
1326a1361
> 			//*(uint16_t*) ((uint8_t*) to + (dst_pitch * 5) + 2) = *(uint16_t*) ((uint8_t*) to + (dst_pitch * 4) + 2);
1329c1364
< 			*(uint16_t*) ((uint8_t*) to + dst_pitch * 2 + 4) = likely(f == g)
---
> 			*(uint16_t*) ((uint8_t*) to + (dst_pitch * 4) + 4) = likely(f == g)
1331a1367
> 			//*(uint16_t*) ((uint8_t*) to + (dst_pitch * 5) + 4) = *(uint16_t*) ((uint8_t*) to + (dst_pitch * 4) + 4);
1334c1370
< 			*(uint16_t*) ((uint8_t*) to + dst_pitch * 2 + 6) = likely(g == h)
---
> 			*(uint16_t*) ((uint8_t*) to + (dst_pitch * 4) + 6) = likely(g == h)
1336a1373
> 			//*(uint16_t*) ((uint8_t*) to + (dst_pitch * 5) + 6) = *(uint16_t*) ((uint8_t*) to + (dst_pitch * 4) + 6);
1345c1382
< 		to   = (uint16_t*) ((uint8_t*) to   + dst_skip + 2 * dst_pitch);
---
> 		to   = (uint16_t*) ((uint8_t*) to   + dst_skip + 5 * dst_pitch);
1353c1390
< 		+ ((GCW0_SCREEN_HEIGHT - GBA_SCREEN_HEIGHT) / 2 * DestPitch)
---
> 		+ ((GCW0_SCREEN_HEIGHT - (GBA_SCREEN_HEIGHT * 2)) / 2 * DestPitch)
1364a1402
> 			//*((uint32_t*) Dest + DestPitch) = bgr555_to_rgb565(*(uint32_t*) Src);
1369c1407
< 		Dest = (uint16_t*) ((uint8_t*) Dest + DestSkip);
---
> 		Dest = (uint16_t*) ((uint8_t*) Dest + DestSkip + DestPitch);
1384a1423
> 			//*((uint32_t*) Dest + DestPitch) = bgr555_to_rgb565(*(uint32_t*) Src);
1389c1428
< 		Dest = (uint16_t*) ((uint8_t*) Dest + DestSkip);
---
> 		Dest = (uint16_t*) ((uint8_t*) Dest + DestSkip + DestPitch);
1480a1520
> 			memset(OutputSurface->pixels, 0, OutputSurface->pitch * GCW0_SCREEN_HEIGHT);
1504,1507d1543
< #ifndef GCW_ZERO
< 			case hardware: /* Hardware, when there's no hardware to scale
< 			                  images, acts as unscaled */
< #endif
1547a1584
>         break;
diff -Nr old_regba/source/opendingux/draw.h new_regba/source/opendingux/draw.h
7c7
< #define GCW0_SCREEN_HEIGHT 240
---
> #define GCW0_SCREEN_HEIGHT 480
diff -Nr old_regba/source/opendingux/.gitignore new_regba/source/opendingux/.gitignore
1,3d0
< .opk_data
< regba.opk
< regba
diff -Nr old_regba/source/opendingux/gui.c new_regba/source/opendingux/gui.c
1539c1539
< 		// Wait. (This is for platforms on which flips don't wait for vertical
---
>     // Wait. (This is for platforms on which flips don't wait for vertical
1543,1545c1543,1548
< 		// Get input.
< 		enum GUI_Action Action = GetGUIAction();
< 		
---
>     // Get input.
>     enum GUI_Action Action = GetGUIAction();
>     if(Action == GUI_ACTION_NONE){
>       continue;
>     }
> 
1602c1605
< 				if (IsGameLoaded && ActiveMenu->AlternateVersion != NULL)
---
> 				if (IsGameLoaded && ActiveMenu->AlternateVersion != NULL) {
1603a1607
>         }
diff -Nr old_regba/source/opendingux/od-input.c new_regba/source/opendingux/od-input.c
25c25
< uint32_t FastForwardTarget = 4; // 6x by default
---
> uint32_t FastForwardTarget = 4; // 4; 6x by default
diff -Nr old_regba/source/opendingux/od-sound.h new_regba/source/opendingux/od-sound.h
11c11
< #define AUDIO_OUTPUT_BUFFER_SIZE 1476
---
> #define AUDIO_OUTPUT_BUFFER_SIZE 2048
diff -Nr old_regba/source/opendingux/port.c new_regba/source/opendingux/port.c
117c117
< 		ScaleModeUnapplied();
---
> 		//ScaleModeUnapplied();

完成


返回上一頁