Skip to content

Commit

Permalink
-Fixed some bugs (many thanks to STAS)
Browse files Browse the repository at this point in the history
-Source for release 1.1.1
  • Loading branch information
sakya_tg committed Feb 24, 2010
1 parent 1770890 commit 4628309
Show file tree
Hide file tree
Showing 70 changed files with 19,692 additions and 2,355 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.TXT
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Version MOD 1.1.1
-----------------
-Fixed bugs by STAS (many thanks)


Version MOD 1.1.0
-----------------
-Added: VFPU Math Library libpspmath version 4 by MrMr[iCE]
Expand Down
73 changes: 42 additions & 31 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@ PSP_FW_VERSION=371
# Project folders
# ---------------

SOURCE_DIR :=
INCLUDE_DIR :=
#<-- STAS: pack all the necessary MikMod stuff directly into libosl.a
# in order to avoid conflict with the newest libmikmod releases.
SOURCE_DIR := ./
MM_DIR := $(SOURCE_DIR)mikmod
INCLUDE_DIR := $(MM_DIR)
#<-- STAS END -->

#----------------------------------------------------------------------------
# Source to make
Expand Down Expand Up @@ -76,11 +80,32 @@ PSPMATHOBJS := $(SOURCE_DIR)libpspmath/printMatrixFloat.o \
$(SOURCE_DIR)libpspmath/vfpu_quaternion_sample_hermite.o \
$(SOURCE_DIR)libpspmath/vfpu_quaternion_hermite_tangent.o

MMLoaderObjs := $(MM_DIR)/mloader.o $(MM_DIR)/mlreg.o $(MM_DIR)/npertab.o \
$(MM_DIR)/sloader.o $(MM_DIR)/load_uni.o $(MM_DIR)/mwav.o \
$(MM_DIR)/load_mod.o $(MM_DIR)/load_m15.o $(MM_DIR)/load_mtm.o \
$(MM_DIR)/load_s3m.o $(MM_DIR)/load_stm.o $(MM_DIR)/load_669.o \
$(MM_DIR)/load_far.o $(MM_DIR)/load_dsm.o $(MM_DIR)/load_med.o \
$(MM_DIR)/load_xm.o $(MM_DIR)/load_ult.o $(MM_DIR)/load_it.o \
$(MM_DIR)/s3m_it.o $(MM_DIR)/load_wav.o

MMDriverObjs := $(MM_DIR)/mdriver.o $(MM_DIR)/mdreg.o $(MM_DIR)/drv_nos.o

MMPlayerObjs := $(MM_DIR)/mplayer.o

MMIOOBJS := $(MM_DIR)/mmio/mmalloc.o \
$(MM_DIR)/mmio/mmerror.o $(MM_DIR)/mmio/mmio.o

MIKMODLIBOBJS := $(MM_DIR)/stream.o \
$(MM_DIR)/virtch.o $(MM_DIR)/munitrk.o \
$(MMLoaderObjs) $(MMDriverObjs) $(MMPlayerObjs)

LIBOBJS := $(SFONTOBJS) \
$(PSPMATHOBJS) \
$(SOURCE_DIR)oslib.o \
$(SOURCE_DIR)vfpu.o \
$(SOURCE_DIR)drawing.o \
$(PSPMATHOBJS) \
$(MMIOOBJS) \
$(MIKMODLIBOBJS) \
$(SOURCE_DIR)oslib.o \
$(SOURCE_DIR)vfpu.o \
$(SOURCE_DIR)drawing.o \
$(SOURCE_DIR)image.o \
$(SOURCE_DIR)palette.o \
$(SOURCE_DIR)shape.o \
Expand Down Expand Up @@ -117,7 +142,8 @@ LIBOBJS := $(SFONTOBJS) \
$(SOURCE_DIR)image/oslSetDrawBuffer.o \
$(SOURCE_DIR)image/oslResetImageProperties.o \
$(SOURCE_DIR)image/oslScaleImage.o \
$(SOURCE_DIR)gif/dev2gif.o $(SOURCE_DIR)gif/dgif_lib.o $(SOURCE_DIR)gif/egif_lib.o $(SOURCE_DIR)gif/gif_err.o $(SOURCE_DIR)gif/gifalloc.o $(SOURCE_DIR)gif/quantize.o \
$(SOURCE_DIR)gif/dev2gif.o $(SOURCE_DIR)gif/dgif_lib.o $(SOURCE_DIR)gif/egif_lib.o \
$(SOURCE_DIR)gif/gif_err.o $(SOURCE_DIR)gif/gifalloc.o $(SOURCE_DIR)gif/quantize.o \
$(SOURCE_DIR)Special/oslLoadImageFilePNG.o \
$(SOURCE_DIR)Special/oslWriteImageFilePNG.o \
$(SOURCE_DIR)Special/oslLoadImageFileJPG.o \
Expand All @@ -127,8 +153,8 @@ LIBOBJS := $(SFONTOBJS) \
$(SOURCE_DIR)splash/oslShowSplashScreen1.o \
$(SOURCE_DIR)splash/oslShowSplashScreen2.o \
$(SOURCE_DIR)mem/oslGetRamStatus.o \
$(SOURCE_DIR)intraFont/intraFont.o \
$(SOURCE_DIR)intraFont/libccc.o
$(SOURCE_DIR)intraFont/intraFont.o \
$(SOURCE_DIR)intraFont/libccc.o

OBJS := $(LIBOBJS)

Expand All @@ -154,7 +180,7 @@ SDK_LIBS := -lpspsdk \
-lpsputility \
-lpspssl -lpsphttp -lpspwlan

EXTERN_LIBS := -lpng \
EXTERN_LIBS := -lpng -ljpeg \
-lz

LIBS := $(EXTERN_LIBS) \
Expand All @@ -172,7 +198,7 @@ DEFINES := -D_DEBUG \
# Compiler settings
# -----------------

CFLAGS := $(DEFINES) -O2 -G0 -g -Wall -DHAVE_AV_CONFIG_H -fno-strict-aliasing -fverbose-asm
CFLAGS := $(DEFINES) -O2 -G0 -ggdb -Wall -DHAVE_AV_CONFIG_H -fno-strict-aliasing -fverbose-asm
#CFLAGS := $(DEFINES) -O2 -G0 -g -frename-registers -ffast-math -fomit-frame-pointer -Wall -DHAVE_AV_CONFIG_H -fno-strict-aliasing
CXXFLAGS := $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS := $(CFLAGS)
Expand All @@ -185,15 +211,18 @@ LDFLAGS :=
# PBP parameters
# --------------

EXTRA_TARGETS := EBOOT.PBP
#EXTRA_TARGETS := EBOOT.PBP
#PSP_EBOOT_ICON := ../ICON0.PNG
#PSP_EBOOT_PIC1 := ../PIC1.PNG
PSP_EBOOT_TITLE := Oldschool Library for PSP
#PSP_EBOOT_TITLE := Oldschool Library for PSP

#----------------------------------------------------------------------------
# Default build settings
# ----------------------

#test:
# echo $(OBJS)

PSPSDK := $(shell psp-config --pspsdk-path)

include $(PSPSDK)/lib/build.mak
Expand All @@ -202,26 +231,8 @@ include $(PSPSDK)/lib/build.mak
# Copy to PSP
# -----------

oslDrawMap.o: oslDrawMap.c
$(CC) $(addprefix -I,$(INCDIR)) $(CFLAGS) -O3 -c -o $@ $<

lib: $(STATICLIB)

$(STATICLIB): $(LIBOBJS)
$(AR) rcs $@ $(LIBOBJS)
$(RANLIB) $@

ifneq ($VS_PATH),)
CC = psp-gcc
endif

kx-install: kxploit
ifeq ($(PSP_MOUNT),)
@echo '*** Error: $$(PSP_MOUNT) undefined. Please set it to for example /cygdrive/e'
@echo if your PSP is mounted to E: in cygwin.
else
cp -r $(TARGET) $(PSP_MOUNT)/PSP/GAME/
cp -r $(TARGET)% $(PSP_MOUNT)/PSP/GAME/
cp $(TARGET).elf $(PSP_MOUNT)/PSP/GAME/$(TARGET)
cp -r -u "../Data" $(PSP_MOUNT)/PSP/GAME/$(TARGET)
endif
1 change: 1 addition & 0 deletions README.TXT
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ copy the oslib directory (containing header files) in $PSPSDK/include/

THANKS
------
STAS for tha patch fixing many bugs
pspZorba for his adhoc sample
MrMr[iCE] for libpspmath
InsertWittyName for all the sdk's dialog samples
Expand Down
204 changes: 103 additions & 101 deletions browser.c
Original file line number Diff line number Diff line change
@@ -1,101 +1,103 @@
#include <pspkernel.h>
#include <pspsdk.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <psputility.h>
#include <psputility_netmodules.h>
#include <psputility_htmlviewer.h>
#include <psphttp.h>

#include "oslib.h"
#include "browser.h"

#define BROWSER_MEMORY (10*1024*1024)

static SceUID vpl;
static pspUtilityHtmlViewerParam params;
static int browserIsActive = 0;

int oslBrowserInit(char *url, char *downloadDir, int browserMemory, unsigned int displaymode, unsigned int options, unsigned int interfacemode, unsigned int connectmode){
int res;
if (browserMemory <= 0)
browserMemory = BROWSER_MEMORY;

vpl = sceKernelCreateVpl("BrowserVpl", PSP_MEMORY_PARTITION_USER, 0, browserMemory + 256, NULL);
if (vpl < 0)
return OSL_BROWSER_ERROR_MEMORY;

memset(&params, 0, sizeof(pspUtilityHtmlViewerParam));

params.base.size = sizeof(pspUtilityHtmlViewerParam);

sceUtilityGetSystemParamInt(PSP_SYSTEMPARAM_ID_INT_LANGUAGE, &params.base.language);
sceUtilityGetSystemParamInt(PSP_SYSTEMPARAM_ID_INT_UNKNOWN, &params.base.buttonSwap);

params.base.graphicsThread = 17;
params.base.accessThread = 19;
params.base.fontThread = 18;
params.base.soundThread = 16;
params.memsize = browserMemory;
params.initialurl = url;
params.numtabs = 1;
params.cookiemode = PSP_UTILITY_HTMLVIEWER_COOKIEMODE_DEFAULT;
params.homeurl = url;
params.textsize = PSP_UTILITY_HTMLVIEWER_TEXTSIZE_NORMAL;
params.displaymode = displaymode;
params.options = options;
params.interfacemode = interfacemode;
params.connectmode = connectmode;

// WITHOUT 'ms0:' on the paths
params.dldirname = downloadDir;

res = sceKernelAllocateVpl(vpl, params.memsize, &params.memaddr, NULL);
if (res < 0)
return OSL_BROWSER_ERROR_MEMORY;

res = sceUtilityHtmlViewerInitStart(&params);
if (res < 0)
return OSL_BROWSER_ERROR_INIT;

browserIsActive = 1;
return 0;
}


void oslDrawBrowser()
{
switch (sceUtilityHtmlViewerGetStatus()){
case PSP_UTILITY_DIALOG_INIT:
case PSP_UTILITY_DIALOG_VISIBLE:
sceGuFinish();
sceGuSync(0,0);
sceUtilityHtmlViewerUpdate(1);
sceGuStart(GU_DIRECT, osl_list);
oslSetAlpha(OSL_FX_RGBA, 0xff);
break;
case PSP_UTILITY_DIALOG_QUIT:
sceUtilityHtmlViewerShutdownStart();
break;
case PSP_UTILITY_DIALOG_NONE:
case PSP_UTILITY_DIALOG_FINISHED:
break;
}
}


int oslGetBrowserStatus(){
return sceUtilityHtmlViewerGetStatus();
}

int oslBrowserIsActive(){
return browserIsActive;
}

void oslEndBrowser(){
sceKernelFreeVpl(vpl, params.memaddr);
sceKernelDeleteVpl(vpl);
browserIsActive = 0;
}
#include <pspkernel.h>
#include <pspsdk.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <psputility.h>
#include <psputility_netmodules.h>
#include <psputility_htmlviewer.h>
#include <psphttp.h>

#include "oslib.h"
#include "browser.h"

#define BROWSER_MEMORY (10*1024*1024)

static SceUID vpl;
static pspUtilityHtmlViewerParam params;
static int browserIsActive = 0;

int oslBrowserInit(char *url, char *downloadDir, int browserMemory, unsigned int displaymode, unsigned int options, unsigned int interfacemode, unsigned int connectmode){
int res;
if (browserMemory <= 0)
browserMemory = BROWSER_MEMORY;

vpl = sceKernelCreateVpl("BrowserVpl", PSP_MEMORY_PARTITION_USER, 0, browserMemory + 256, NULL);
if (vpl < 0)
return OSL_BROWSER_ERROR_MEMORY;

memset(&params, 0, sizeof(pspUtilityHtmlViewerParam));

params.base.size = sizeof(pspUtilityHtmlViewerParam);

sceUtilityGetSystemParamInt(PSP_SYSTEMPARAM_ID_INT_LANGUAGE, &params.base.language);
sceUtilityGetSystemParamInt(PSP_SYSTEMPARAM_ID_INT_UNKNOWN, &params.base.buttonSwap);

params.base.graphicsThread = 17;
params.base.accessThread = 19;
params.base.fontThread = 18;
params.base.soundThread = 16;
params.memsize = browserMemory;
params.initialurl = url;
params.numtabs = 1;
params.cookiemode = PSP_UTILITY_HTMLVIEWER_COOKIEMODE_DEFAULT;
params.homeurl = url;
params.textsize = PSP_UTILITY_HTMLVIEWER_TEXTSIZE_NORMAL;
params.displaymode = displaymode;
params.options = options;
params.interfacemode = interfacemode;
params.connectmode = connectmode;

// WITHOUT 'ms0:' on the paths
params.dldirname = downloadDir;

res = sceKernelAllocateVpl(vpl, params.memsize, &params.memaddr, NULL);
if (res < 0)
return OSL_BROWSER_ERROR_MEMORY;

res = sceUtilityHtmlViewerInitStart(&params);
if (res < 0)
return res; //<-- STAS: Such a return value is more informative...
// return OSL_BROWSER_ERROR_INIT;

browserIsActive = 1;
return 0;
}


void oslDrawBrowser()
{
switch (sceUtilityHtmlViewerGetStatus()){
case PSP_UTILITY_DIALOG_INIT:
break; //<-- STAS: We shouldn't show the browser in its INIT status!
case PSP_UTILITY_DIALOG_VISIBLE:
sceGuFinish();
sceGuSync(0,0);
sceUtilityHtmlViewerUpdate(1);
sceGuStart(GU_DIRECT, osl_list);
oslSetAlpha(OSL_FX_RGBA, 0xff);
break;
case PSP_UTILITY_DIALOG_QUIT:
sceUtilityHtmlViewerShutdownStart();
break;
case PSP_UTILITY_DIALOG_NONE:
case PSP_UTILITY_DIALOG_FINISHED:
break;
}
}


int oslGetBrowserStatus(){
return sceUtilityHtmlViewerGetStatus();
}

int oslBrowserIsActive(){
return browserIsActive;
}

void oslEndBrowser(){
sceKernelFreeVpl(vpl, params.memaddr);
sceKernelDeleteVpl(vpl);
browserIsActive = 0;
}
Loading

0 comments on commit 4628309

Please sign in to comment.