Fixes to the NDS sprite2 test. Illustrates partially working texture-as-sprite functionality.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403203
This commit is contained in:
Darren Alton 2008-09-06 04:31:34 +00:00
parent a2947b8889
commit e5621bf196
5 changed files with 95 additions and 159 deletions

View file

@ -43,8 +43,8 @@ typedef struct
} NDS_HapticData;
void NDS_EZF_OpenNorWrite()
void
NDS_EZF_OpenNorWrite()
{
GBA_BUS[0x0FF0000] = 0xD200;
GBA_BUS[0x0000000] = 0x1500;
@ -52,10 +52,9 @@ void NDS_EZF_OpenNorWrite()
GBA_BUS[0x0020000] = 0x1500;
GBA_BUS[0x0E20000] = 0x1500;
GBA_BUS[0x0FE0000] = 0x1500;
}
} void
void NDS_EZF_CloseNorWrite()
NDS_EZF_CloseNorWrite()
{
GBA_BUS[0x0FF0000] = 0xD200;
GBA_BUS[0x0000000] = 0x1500;
@ -65,12 +64,12 @@ void NDS_EZF_CloseNorWrite()
GBA_BUS[0x0FE0000] = 0x1500;
}
void NDS_EZF_ChipReset()
void
NDS_EZF_ChipReset()
{
GBA_BUS[0x0000] = 0x00F0;
GBA_BUS[0x1000] = 0x00F0;
}
uint32 NDS_EZF_IsPresent()
} uint32 NDS_EZF_IsPresent()
{
vuint16 id1, id2;
@ -82,31 +81,25 @@ uint32 NDS_EZF_IsPresent()
GBA_BUS[0x1555] = 0x00AA;
GBA_BUS[0x12AA] = 0x0055;
GBA_BUS[0x1555] = 0x0090;
id1 = GBA_BUS[0x0001];
id2 = GBA_BUS[0x1001];
if ((id1 != 0x227E) || (id2 != 0x227E)) {
NDS_EZF_CloseNorWrite();
return 0;
}
id1 = GBA_BUS[0x000E];
id2 = GBA_BUS[0x100E];
NDS_EZF_CloseNorWrite();
if (id1 == 0x2218 && id2 == 0x2218) {
return 1;
}
return 0;
}
void NDS_EZF_SetShake(u8 pos)
void
NDS_EZF_SetShake(u8 pos)
{
u16 data = ((pos % 3) | 0x00F0);
GBA_BUS[0x0FF0000] = 0xD200;
GBA_BUS[0x0000000] = 0x1500;
GBA_BUS[0x0010000] = 0xD200;
@ -152,9 +145,12 @@ SDL_SYS_HapticName(int index)
{
if (nds_haptic) {
switch (nds_haptic->hwdata->type) {
case OFFICIAL: return "Nintendo DS Rumble Pak";
case EZF3IN1: return "EZFlash 3-in-1 Rumble";
default: return NULL;
case OFFICIAL:
return "Nintendo DS Rumble Pak";
case EZF3IN1:
return "EZFlash 3-in-1 Rumble";
default:
return NULL;
}
}
return NULL;

View file

@ -44,7 +44,8 @@
int
SDL_SYS_JoystickInit(void)
{
SDL_numjoysticks = 1; return (1);
SDL_numjoysticks = 1;
return (1);
}
/* Function to get the device-dependent name of a joystick */
@ -169,4 +170,3 @@ SDL_SYS_JoystickQuit(void)
}
#endif /* SDL_JOYSTICK_NDS */

Binary file not shown.

After

Width:  |  Height:  |  Size: 578 B

View file

@ -7,8 +7,6 @@
#include <fat.h>
#include "common.h"
#include "icon_bmp_bin.h"
#define NUM_SPRITES 10
#define MAX_SPEED 1
@ -184,66 +182,7 @@ main(int argc, char *argv[])
if (!state) {
return 1;
}
for (i = 1; i < argc;) {
int consumed;
consumed = CommonArg(state, i);
if (consumed == 0) {
consumed = -1;
if (SDL_strcasecmp(argv[i], "--blend") == 0) {
if (argv[i + 1]) {
if (SDL_strcasecmp(argv[i + 1], "none") == 0) {
blendMode = SDL_TEXTUREBLENDMODE_NONE;
consumed = 2;
} else if (SDL_strcasecmp(argv[i + 1], "mask") == 0) {
blendMode = SDL_TEXTUREBLENDMODE_MASK;
consumed = 2;
} else if (SDL_strcasecmp(argv[i + 1], "blend") == 0) {
blendMode = SDL_TEXTUREBLENDMODE_BLEND;
consumed = 2;
} else if (SDL_strcasecmp(argv[i + 1], "add") == 0) {
blendMode = SDL_TEXTUREBLENDMODE_ADD;
consumed = 2;
} else if (SDL_strcasecmp(argv[i + 1], "mod") == 0) {
blendMode = SDL_TEXTUREBLENDMODE_MOD;
consumed = 2;
}
}
} else if (SDL_strcasecmp(argv[i], "--scale") == 0) {
if (argv[i + 1]) {
if (SDL_strcasecmp(argv[i + 1], "none") == 0) {
scaleMode = SDL_TEXTURESCALEMODE_NONE;
consumed = 2;
} else if (SDL_strcasecmp(argv[i + 1], "fast") == 0) {
scaleMode = SDL_TEXTURESCALEMODE_FAST;
consumed = 2;
} else if (SDL_strcasecmp(argv[i + 1], "slow") == 0) {
scaleMode = SDL_TEXTURESCALEMODE_SLOW;
consumed = 2;
} else if (SDL_strcasecmp(argv[i + 1], "best") == 0) {
scaleMode = SDL_TEXTURESCALEMODE_BEST;
consumed = 2;
}
}
} else if (SDL_strcasecmp(argv[i], "--cyclecolor") == 0) {
cycle_color = SDL_TRUE;
consumed = 1;
} else if (SDL_strcasecmp(argv[i], "--cyclealpha") == 0) {
cycle_alpha = SDL_TRUE;
consumed = 1;
} else if (SDL_isdigit(*argv[i])) {
num_sprites = SDL_atoi(argv[i]);
consumed = 1;
}
}
if (consumed < 0) {
fprintf(stderr,
"Usage: %s %s [--blend none|mask|blend|add|mod] [--scale none|fast|slow|best] [--cyclecolor] [--cyclealpha]\n",
argv[0], CommonUsage(state));
quit(1);
}
i += consumed;
}
if (!CommonInit(state)) {
quit(2);
}
@ -259,8 +198,9 @@ main(int argc, char *argv[])
SDL_SelectRenderer(state->windows[i]);
SDL_RenderFill(0xA0, 0xA0, 0xA0, 0xFF, NULL);
}
if (LoadSprite2(icon_bmp_bin, icon_bmp_bin_size) < 0) {
printf("errored.\n");
if (LoadSprite("icon.bmp") < 0) {
printf("\nerrored.\n");
while (1);
quit(2);
}