Skip to content

Commit

Permalink
Cleanup, Remove warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
infval committed Nov 22, 2018
1 parent 14f9222 commit 80f1538
Show file tree
Hide file tree
Showing 16 changed files with 40 additions and 1,227 deletions.
24 changes: 14 additions & 10 deletions Makefile.psp
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,20 @@ EXTRA_TARGETS=EBOOT.PBP
PSP_EBOOT_TITLE=$(PSP_APP_NAME) $(PSP_APP_VER)
PSP_EBOOT_ICON=$(PSPAPP)/potator-icon.png

POTAROOT=common

BUILD_EMUL=\
common/controls.o \
common/gpu.o \
common/memorymap.o \
common/sound.o \
common/timer.o \
common/watara.o \
common/m6502/m6502.o
BUILD_PORT=$(PSPAPP)/emulate.o \
$(PSPAPP)/main.o $(PSPAPP)/menu.o
$(POTAROOT)/controls.o \
$(POTAROOT)/gpu.o \
$(POTAROOT)/memorymap.o \
$(POTAROOT)/sound.o \
$(POTAROOT)/timer.o \
$(POTAROOT)/watara.o \
$(POTAROOT)/m6502/m6502.o
BUILD_PORT=\
$(PSPAPP)/emulate.o \
$(PSPAPP)/menu.o \
$(PSPAPP)/main.o

OBJS=$(BUILD_EMUL) $(BUILD_PORT)

Expand All @@ -33,7 +37,7 @@ BASE_DEFS=-DPSP -DPSP_APP_VER=\"$(PSP_APP_VER)\" -DPSP_APP_NAME="\"$(PSP_APP_NAM
CFLAGS=-O2 -G0 -Wall $(BASE_DEFS) $(DEFINES)
CXXFLAGS=$(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS=$(CFLAGS)
INCDIR=$(PSPLIB) $(MZLIB) $(PSPAPP) common/m6502 common
INCDIR=$(PSPLIB) $(MZLIB) $(PSPAPP) $(POTAROOT)/m6502 $(POTAROOT)
LIBDIR=$(PSPLIB) $(MZLIB)
LIBS=-lpsplib -lpng -lpspgu -lpsppower -lminizip \
-lz -lm -lc -lpspaudio -lpsprtc -lpspwlan -lpspnet_adhoc \
Expand Down
82 changes: 0 additions & 82 deletions PSP/controls.cpp

This file was deleted.

13 changes: 0 additions & 13 deletions PSP/controls.h

This file was deleted.

13 changes: 8 additions & 5 deletions PSP/minizip/unzip.c
Original file line number Diff line number Diff line change
Expand Up @@ -607,11 +607,12 @@ local int unzlocal_GetCurrentFileInfoInternal (file,


/* we check the magic */
if (err==UNZ_OK)
if (err==UNZ_OK) {
if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK)
err=UNZ_ERRNO;
else if (uMagic!=0x02014b50)
err=UNZ_BADZIPFILE;
}

if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.version) != UNZ_OK)
err=UNZ_ERRNO;
Expand Down Expand Up @@ -687,11 +688,12 @@ local int unzlocal_GetCurrentFileInfoInternal (file,
else
uSizeRead = extraFieldBufferSize;

if (lSeek!=0)
if (lSeek!=0) {
if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
lSeek=0;
else
err=UNZ_ERRNO;
}
if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0))
if (ZREAD(s->z_filefunc, s->filestream,extraField,uSizeRead)!=uSizeRead)
err=UNZ_ERRNO;
Expand All @@ -712,11 +714,12 @@ local int unzlocal_GetCurrentFileInfoInternal (file,
else
uSizeRead = commentBufferSize;

if (lSeek!=0)
if (lSeek!=0) {
if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
lSeek=0;
else
err=UNZ_ERRNO;
}
if ((file_info.size_file_comment>0) && (commentBufferSize>0))
if (ZREAD(s->z_filefunc, s->filestream,szComment,uSizeRead)!=uSizeRead)
err=UNZ_ERRNO;
Expand Down Expand Up @@ -976,11 +979,12 @@ local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar,
return UNZ_ERRNO;


if (err==UNZ_OK)
if (err==UNZ_OK) {
if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK)
err=UNZ_ERRNO;
else if (uMagic!=0x04034b50)
err=UNZ_BADZIPFILE;
}

if (unzlocal_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK)
err=UNZ_ERRNO;
Expand Down Expand Up @@ -1534,7 +1538,6 @@ extern int ZEXPORT unzGetGlobalComment (file, szComment, uSizeBuf)
char *szComment;
uLong uSizeBuf;
{
int err=UNZ_OK;
unz_s* s;
uLong uReadThis ;
if (file==NULL)
Expand Down
2 changes: 1 addition & 1 deletion PSP/psplib/pl_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ static void sort_file_list(pl_file_list *list,

/* Copy the file entries to an array */
files = (pl_file**)malloc(sizeof(pl_file*) * count);
for (file = list->files, fp = files; file; file = file->next, i++, fp++)
for (file = list->files, fp = files; file; file = file->next, fp++)
*fp = file;

/* Sort the array */
Expand Down
4 changes: 2 additions & 2 deletions PSP/psplib/pl_gfx.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,12 @@ void pl_video_put_image(const pl_image *image,
sceGuTexFilter(GU_LINEAR, GU_LINEAR);

pl_gfx_vertex *vertices;
int start, end, sc_end, slsz_scaled;
int start, end, /*sc_end,*/ slsz_scaled;
slsz_scaled = ceil((float)dw * (float)SLICE_SIZE) / (float)image->view.w;

start = image->view.x;
end = image->view.x + image->view.w;
sc_end = dx + dw;
/*sc_end = dx + dw;*/

for (; start < end; start += SLICE_SIZE, dx += slsz_scaled)
{
Expand Down
4 changes: 2 additions & 2 deletions PSP/psplib/pl_image.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ int pl_image_save_png_stream(const pl_image *image,
int height = image->view.h;
int bytes_per_pixel = pl_image_get_bytes_per_pixel(image->format);
void *line_ptr, *pel_ptr;
uint32_t color;
uint32_t color = 0;

if (!(bitmap = (u8*)malloc(sizeof(u8) * width * height * 3)))
return 0;
Expand Down Expand Up @@ -558,7 +558,7 @@ int pl_image_create_thumbnail(const pl_image *original,
}

int x, y;
uint32_t color;
uint32_t color = 0;
uint bytes_per_pixel =
pl_image_get_bytes_per_pixel(original->format);
void *slp = original->bitmap + original->view.y * original->pitch;
Expand Down
5 changes: 1 addition & 4 deletions PSP/psplib/pl_ini.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,14 @@ int pl_ini_load(pl_ini_file *file,
return 0;

pl_ini_section *current_section = NULL;
pl_ini_pair *tail;
pl_ini_pair *tail = NULL;

char string[PL_MAX_LINE_LENGTH],
name[PL_MAX_LINE_LENGTH];
char *ptr;
int len;

/* Create unnamed section */
current_section = NULL;
tail = NULL;

while(!feof(stream) && fgets(string, sizeof(string), stream))
{
/* TODO: Skip whitespace */
Expand Down
4 changes: 2 additions & 2 deletions PSP/psplib/pl_snd.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,15 +313,15 @@ static unsigned int get_bytes_per_sample(int channel)

int pl_snd_pause(int channel)
{
if (channel < 0 || channel > AUDIO_CHANNELS)
if (channel < 0 || channel >= AUDIO_CHANNELS)
return 0;
sound_stream[channel].paused = 1;
return 1;
}

int pl_snd_resume(int channel)
{
if (channel < 0 || channel > AUDIO_CHANNELS)
if (channel < 0 || channel >= AUDIO_CHANNELS)
return 0;
sound_stream[channel].paused = 0;
return 1;
Expand Down
10 changes: 5 additions & 5 deletions PSP/psplib/pl_vk.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ int pl_vk_load(pl_vk_layout *layout,
return 0;
}

int code;
uint32_t code;
uint16_t x, y, w, h;

/* Determine button count */
while ((fscanf(file, "0x%x\t%hi\t%hi\t%hi\t%hi\n",
while ((fscanf(file, "0x%x\t%hu\t%hu\t%hu\t%hu\n",
&code, &x, &y, &w, &h) == 5) && code)
layout->key_count++;

Expand All @@ -132,7 +132,7 @@ int pl_vk_load(pl_vk_layout *layout,
pl_vk_button *button;
for (i = 0, button = layout->keys; i < layout->key_count; i++, button++)
{
if (fscanf(file, "0x%x\t%hi\t%hi\t%hi\t%hi\n",
if (fscanf(file, "0x%x\t%hu\t%hu\t%hu\t%hu\n",
&code, &x, &y, &w, &h) < 5)
{
fclose(file);
Expand All @@ -149,7 +149,7 @@ int pl_vk_load(pl_vk_layout *layout,
}

/* "Swallow" last record */
fscanf(file, "0x%x\t%hi\t%hi\t%hi\t%hi\n",
fscanf(file, "0x%x\t%hu\t%hu\t%hu\t%hu\n",
&code, &x, &y, &w, &h);

/* Determine sticky count */
Expand Down Expand Up @@ -224,7 +224,7 @@ int pl_vk_load(pl_vk_layout *layout,
fscanf(file, "0x%x\t", &code);

/* Read the offsets */
if (fscanf(file, "%hi\t%hi\n",
if (fscanf(file, "%hu\t%hu\n",
&layout->offset_x, &layout->offset_y) < 2)
{
fclose(file);
Expand Down
2 changes: 1 addition & 1 deletion PSP/psplib/ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ struct AdhocMatchEvent
int NewEvent;
int EventID;
PspMAC EventMAC;
PspMAC CurrentMAC;
PspMAC CurrentMAC; /* is never used */
char OptData[512];
};

Expand Down
8 changes: 4 additions & 4 deletions PSP/psplib/video.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,12 +253,12 @@ void pspVideoPutImage(const PspImage *image, int dx, int dy, int dw, int dh)
sceGuTexFilter(GU_LINEAR, GU_LINEAR);

struct TexVertex* vertices;
int start, end, sc_end, slsz_scaled;
int start, end, /*sc_end,*/ slsz_scaled;
slsz_scaled = ceil((float)dw * (float)SLICE_SIZE) / (float)image->Viewport.Width;

start = image->Viewport.X;
end = image->Viewport.X + image->Viewport.Width;
sc_end = dx + dw;
/*sc_end = dx + dw;*/

/* TODO: Convert to floating-point coords */
for (; start < end; start += SLICE_SIZE, dx += slsz_scaled)
Expand Down Expand Up @@ -340,12 +340,12 @@ void pspVideoPutImageAlpha(const PspImage *image, int dx, int dy, int dw, int dh
sceGuTexFilter(GU_LINEAR, GU_LINEAR);

struct TexVertex* vertices;
int start, end, sc_end, slsz_scaled;
int start, end, /*sc_end,*/ slsz_scaled;
slsz_scaled = ceil((float)dw * (float)SLICE_SIZE) / (float)image->Viewport.Width;

start = image->Viewport.X;
end = image->Viewport.X + image->Viewport.Width;
sc_end = dx + dw;
/*sc_end = dx + dw;*/

/* TODO: Convert to floating-point coords */
for (; start < end; start += SLICE_SIZE, dx += slsz_scaled)
Expand Down
Loading

0 comments on commit 80f1538

Please sign in to comment.