dosbox, now with 100% less drama

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

Moderators: cheriff, TyRaNiD

Post Reply
crazyc
Posts: 408
Joined: Fri Jun 17, 2005 10:13 am

dosbox, now with 100% less drama

Post by crazyc »

I've fixed most of the bugs that I could find in the 3.x build of dosbox (at least with the fat psp). Now you should be able to exit and set any about of memory in the conf file as long as it can be allocated with malloc. Also, with a pair of prx's it has the same functionality as the 1.5 build. Neither prx is necessary to run the program.

EBOOT.PBP the main binary

exception.prx if this prx is present, crash dumps will be displayed

fixup.prx if the prx if present, the ME region will be added to the code cache.

dosbox.patch.gz the patch

If anyone is interested in the source to the prx's, I'll post it. Also, if anyone is interested in configurable p_sprint keymaps, that should be doable, but if no one cares, I won't bother.
Last edited by crazyc on Mon Dec 15, 2008 6:30 am, edited 1 time in total.
SamuraiX
Posts: 76
Joined: Tue Jan 31, 2006 6:28 am
Location: USA
Contact:

Post by SamuraiX »

Wait a sec.... exception.prx is a exception handler for 3.xx? If so, would you mind sharing the source as I would love to see what I was missing from getting it to work on my end.

Thank You crazyc!
aTomIC
Posts: 35
Joined: Tue Aug 28, 2007 9:18 pm
Contact:

Post by aTomIC »

i tested it on my fat psp with 3.52-4 in 1.50 Kernel Mode and it works well. What are the other files? Are there for the 3.xx? What should i do with exception.prx and fixup.prx? Sorry, but i did not own a PSP Slim.

PS.:
i updated my database with the new release...

PPS.:
I wish you and all other members of this forum a happy new year if you (or the others) not visiting this thread.


Get the latest builds in packages at:
http://www.emunews24.de/dosemus.html#sony%20psp257 for Sony PSP
http://www.emunews24.de/dosemus.html#so ... %20slim257 for Sony PSP Slim
Image
crazyc
Posts: 408
Joined: Fri Jun 17, 2005 10:13 am

Post by crazyc »

SamuraiX wrote:Wait a sec.... exception.prx is a exception handler for 3.xx? If so, would you mind sharing the source as I would love to see what I was missing from getting it to work on my end.

Thank You crazyc!

Code: Select all

#include <pspkernel.h>
#include <psppower.h>
#include <pspdebug.h>

PSP_MODULE_INFO&#40;"exception", 0x1007, 1, 1&#41;;  // better not unload

PspDebugErrorHandler curr_handler;
PspDebugRegBlock *exception_regs;

void _pspDebugExceptionHandler&#40;void&#41;;
int sceKernelRegisterDefaultExceptionHandler&#40;void *func&#41;;
int sceKernelRegisterDefaultExceptionHandler371&#40;void *func&#41;;

int module_start&#40;SceSize args, void *argp&#41;
&#123;
	int ret;
	if&#40;args != 8&#41; return -1;
	curr_handler = &#40;PspDebugErrorHandler&#41;&#40;&#40;int *&#41;argp&#41;&#91;0&#93;;
	exception_regs = &#40;PspDebugRegBlock *&#41;&#40;&#40;int *&#41;argp&#41;&#91;1&#93;;
	if&#40;!curr_handler || !exception_regs&#41; return -1;

	if&#40;sceKernelDevkitVersion&#40;&#41; < 0x03070110&#41;
		return sceKernelRegisterDefaultExceptionHandler&#40;&#40;void *&#41;_pspDebugExceptionHandler&#41;;
	else
		return sceKernelRegisterDefaultExceptionHandler371&#40;&#40;void *&#41;_pspDebugExceptionHandler&#41;;
&#125;

Code: Select all

#include "as_reg_compat.h"
	.set noreorder
	.set noat

#define BadVAddr $8  // Address for the most recent address-related exception
#define Status   $12 // Processor status and control
#define Cause    $13 // Cause of last general exception
#define EPC      $14 // Program counter at last exception
#define PRId     $15 // Processor identification and revision

#define FSR		 $31
#define FIR      $0

#define REG_GPR_0    &#40;6*4&#41;
#define REG_GPR_1	 &#40;REG_GPR_0 + 4&#41;
#define REG_GPR_2	 &#40;REG_GPR_1 + 4&#41;
#define REG_GPR_3	 &#40;REG_GPR_2 + 4&#41;
#define REG_GPR_4	 &#40;REG_GPR_3 + 4&#41;
#define REG_GPR_5	 &#40;REG_GPR_4 + 4&#41;
#define REG_GPR_6	 &#40;REG_GPR_5 + 4&#41;
#define REG_GPR_7	 &#40;REG_GPR_6 + 4&#41;
#define REG_GPR_8	 &#40;REG_GPR_7 + 4&#41;
#define REG_GPR_9	 &#40;REG_GPR_8 + 4&#41;
#define REG_GPR_10	 &#40;REG_GPR_9 + 4&#41;
#define REG_GPR_11	 &#40;REG_GPR_10 + 4&#41;
#define REG_GPR_12	 &#40;REG_GPR_11 + 4&#41;
#define REG_GPR_13	 &#40;REG_GPR_12 + 4&#41;
#define REG_GPR_14	 &#40;REG_GPR_13 + 4&#41;
#define REG_GPR_15	 &#40;REG_GPR_14 + 4&#41;
#define REG_GPR_16	 &#40;REG_GPR_15 + 4&#41;
#define REG_GPR_17	 &#40;REG_GPR_16 + 4&#41;
#define REG_GPR_18	 &#40;REG_GPR_17 + 4&#41;
#define REG_GPR_19	 &#40;REG_GPR_18 + 4&#41;
#define REG_GPR_20	 &#40;REG_GPR_19 + 4&#41;
#define REG_GPR_21	 &#40;REG_GPR_20 + 4&#41;
#define REG_GPR_22	 &#40;REG_GPR_21 + 4&#41;
#define REG_GPR_23	 &#40;REG_GPR_22 + 4&#41;
#define REG_GPR_24	 &#40;REG_GPR_23 + 4&#41;
#define REG_GPR_25	 &#40;REG_GPR_24 + 4&#41;
#define REG_GPR_26	 &#40;REG_GPR_25 + 4&#41;
#define REG_GPR_27	 &#40;REG_GPR_26 + 4&#41;
#define REG_GPR_28	 &#40;REG_GPR_27 + 4&#41;
#define REG_GPR_29	 &#40;REG_GPR_28 + 4&#41;
#define REG_GPR_30	 &#40;REG_GPR_29 + 4&#41;
#define REG_GPR_31	 &#40;REG_GPR_30 + 4&#41;

#define REG_STATUS	 &#40;REG_GPR_31 + 4&#41;
#define REG_LO  	 &#40;REG_STATUS + 4&#41;
#define REG_HI	     &#40;REG_LO + 4&#41;
#define REG_BADVADDR &#40;REG_HI + 4&#41;
#define REG_CAUSE	 &#40;REG_BADVADDR + 4&#41;
#define REG_EPC	 	 &#40;REG_CAUSE + 4&#41;

#define REG_FPR_0 	 &#40;REG_EPC + 4&#41;
#define REG_FPR_1	 &#40;REG_FPR_0 + 4&#41;
#define REG_FPR_2	 &#40;REG_FPR_1 + 4&#41;
#define REG_FPR_3	 &#40;REG_FPR_2 + 4&#41;
#define REG_FPR_4	 &#40;REG_FPR_3 + 4&#41;
#define REG_FPR_5	 &#40;REG_FPR_4 + 4&#41;
#define REG_FPR_6	 &#40;REG_FPR_5 + 4&#41;
#define REG_FPR_7	 &#40;REG_FPR_6 + 4&#41;
#define REG_FPR_8	 &#40;REG_FPR_7 + 4&#41;
#define REG_FPR_9	 &#40;REG_FPR_8 + 4&#41;
#define REG_FPR_10	 &#40;REG_FPR_9 + 4&#41;
#define REG_FPR_11	 &#40;REG_FPR_10 + 4&#41;
#define REG_FPR_12	 &#40;REG_FPR_11 + 4&#41;
#define REG_FPR_13	 &#40;REG_FPR_12 + 4&#41;
#define REG_FPR_14	 &#40;REG_FPR_13 + 4&#41;
#define REG_FPR_15	 &#40;REG_FPR_14 + 4&#41;
#define REG_FPR_16	 &#40;REG_FPR_15 + 4&#41;
#define REG_FPR_17	 &#40;REG_FPR_16 + 4&#41;
#define REG_FPR_18	 &#40;REG_FPR_17 + 4&#41;
#define REG_FPR_19	 &#40;REG_FPR_18 + 4&#41;
#define REG_FPR_20	 &#40;REG_FPR_19 + 4&#41;
#define REG_FPR_21	 &#40;REG_FPR_20 + 4&#41;
#define REG_FPR_22	 &#40;REG_FPR_21 + 4&#41;
#define REG_FPR_23	 &#40;REG_FPR_22 + 4&#41;
#define REG_FPR_24	 &#40;REG_FPR_23 + 4&#41;
#define REG_FPR_25	 &#40;REG_FPR_24 + 4&#41;
#define REG_FPR_26	 &#40;REG_FPR_25 + 4&#41;
#define REG_FPR_27	 &#40;REG_FPR_26 + 4&#41;
#define REG_FPR_28	 &#40;REG_FPR_27 + 4&#41;
#define REG_FPR_29	 &#40;REG_FPR_28 + 4&#41;
#define REG_FPR_30	 &#40;REG_FPR_29 + 4&#41;
#define REG_FPR_31	 &#40;REG_FPR_30 + 4&#41;

#define REG_FSR		 &#40;REG_FPR_31 + 4&#41;
#define REG_FIR      &#40;REG_FSR + 4&#41;
#define REG_FP       &#40;REG_FIR + 4&#41;

	.extern exception_regs
	.extern curr_handler

	.global _pspDebugExceptionHandler
	.ent    _pspDebugExceptionHandler
_pspDebugExceptionHandler&#58;
	nop
	nop

	lw		$v0, exception_regs
	sw		$0, REG_GPR_0&#40;$v0&#41;
	sw		$1, REG_GPR_1&#40;$v0&#41;

	cfc0	$1, $4					# Get original v0
	sw		$1, REG_GPR_2&#40;$v0&#41;
	cfc0 	$1, $5					# Get original v1
	sw		$1, REG_GPR_3&#40;$v0&#41;
	sw		$4, REG_GPR_4&#40;$v0&#41;
	sw		$5, REG_GPR_5&#40;$v0&#41;
	sw		$6, REG_GPR_6&#40;$v0&#41;
	sw		$7, REG_GPR_7&#40;$v0&#41;
	sw		$8, REG_GPR_8&#40;$v0&#41;
	sw		$9, REG_GPR_9&#40;$v0&#41;
	sw		$10, REG_GPR_10&#40;$v0&#41;
	sw		$11, REG_GPR_11&#40;$v0&#41;
	sw		$12, REG_GPR_12&#40;$v0&#41;
	sw		$13, REG_GPR_13&#40;$v0&#41;
	sw		$14, REG_GPR_14&#40;$v0&#41;
	sw		$15, REG_GPR_15&#40;$v0&#41;
	sw		$16, REG_GPR_16&#40;$v0&#41;
	sw		$17, REG_GPR_17&#40;$v0&#41;
	sw		$18, REG_GPR_18&#40;$v0&#41;
	sw		$19, REG_GPR_19&#40;$v0&#41;
	sw		$20, REG_GPR_20&#40;$v0&#41;
	sw		$21, REG_GPR_21&#40;$v0&#41;
	sw		$22, REG_GPR_22&#40;$v0&#41;
	sw		$23, REG_GPR_23&#40;$v0&#41;
	sw		$24, REG_GPR_24&#40;$v0&#41;
	sw		$25, REG_GPR_25&#40;$v0&#41;
	sw		$26, REG_GPR_26&#40;$v0&#41;
	sw		$27, REG_GPR_27&#40;$v0&#41;
	sw		$28, REG_GPR_28&#40;$v0&#41;
	sw		$29, REG_GPR_29&#40;$v0&#41;
	sw		$30, REG_GPR_30&#40;$v0&#41;
	sw		$31, REG_GPR_31&#40;$v0&#41;

	mflo	$v1
	sw		$v1,  REG_LO&#40;$v0&#41;
	mfhi	$v1
	sw		$v1,  REG_HI&#40;$v0&#41;
	mfc0	$v1,  BadVAddr
	sw		$v1,  REG_BADVADDR&#40;$v0&#41;
	mfc0	$v1,  Cause
	sw		$v1,  REG_CAUSE&#40;$v0&#41;
	mfc0	$v1,  EPC
	sw		$v1,  REG_EPC&#40;$v0&#41;
	mfc0	$v1,  Status
	sw		$v1,  REG_STATUS&#40;$v0&#41;

# Check if cop1 is enable and skip if not
	lui		$a0, 0x2000
	and		$a0, $a0, $v1
	beq		$a0, $0, 1f
	nop

	swc1		$0, REG_FPR_0&#40;$v0&#41;
	swc1		$1, REG_FPR_1&#40;$v0&#41;
	swc1		$2, REG_FPR_2&#40;$v0&#41;
	swc1		$3, REG_FPR_3&#40;$v0&#41;
	swc1		$4, REG_FPR_4&#40;$v0&#41;
	swc1		$5, REG_FPR_5&#40;$v0&#41;
	swc1		$6, REG_FPR_6&#40;$v0&#41;
	swc1		$7, REG_FPR_7&#40;$v0&#41;
	swc1		$8, REG_FPR_8&#40;$v0&#41;
	swc1		$9, REG_FPR_9&#40;$v0&#41;
	swc1		$10, REG_FPR_10&#40;$v0&#41;
	swc1		$11, REG_FPR_11&#40;$v0&#41;
	swc1		$12, REG_FPR_12&#40;$v0&#41;
	swc1		$13, REG_FPR_13&#40;$v0&#41;
	swc1		$14, REG_FPR_14&#40;$v0&#41;
	swc1		$15, REG_FPR_15&#40;$v0&#41;
	swc1		$16, REG_FPR_16&#40;$v0&#41;
	swc1		$17, REG_FPR_17&#40;$v0&#41;
	swc1		$18, REG_FPR_18&#40;$v0&#41;
	swc1		$19, REG_FPR_19&#40;$v0&#41;
	swc1		$20, REG_FPR_20&#40;$v0&#41;
	swc1		$21, REG_FPR_21&#40;$v0&#41;
	swc1		$22, REG_FPR_22&#40;$v0&#41;
	swc1		$23, REG_FPR_23&#40;$v0&#41;
	swc1		$24, REG_FPR_24&#40;$v0&#41;
	swc1		$25, REG_FPR_25&#40;$v0&#41;
	swc1		$26, REG_FPR_26&#40;$v0&#41;
	swc1		$27, REG_FPR_27&#40;$v0&#41;
	swc1		$28, REG_FPR_28&#40;$v0&#41;
	swc1		$29, REG_FPR_29&#40;$v0&#41;
	swc1		$30, REG_FPR_30&#40;$v0&#41;
	swc1		$31, REG_FPR_31&#40;$v0&#41;

	cfc1 		$t0, FSR
	sw			$t0, REG_FSR&#40;$v0&#41;
	cfc1		$t0, FIR
	sw			$t0, REG_FIR&#40;$v0&#41;
	ctc1		$0, FSR			# Clear any cause flags

# Jump target for ignore cop1
1&#58;

	sw			$sp, REG_FP&#40;$v0&#41;
	move		$a0, $v0

	lw		$2, curr_handler
	mtc0	$2, $14
	nop
	nop
	eret
	nop
	nop

	.end _pspDebugExceptionHandler

	#include "pspimport.s"

	IMPORT_START	"ExceptionManagerForKernel",0x00010011
	IMPORT_FUNC	"ExceptionManagerForKernel",0x565C0B0E,sceKernelRegisterDefaultExceptionHandler371

If you are using the code straight from libpspdebug, be sure you put a nop after "beq $a0, $0, 1f" otherwise, if cop1 is disabled, you will get a coprocessor unusable fault in exception mode.
What should i do with exception.prx and fixup.prx?
Put them in the same directory as EBOOT.PBP.


BTW, for the pspsdk maintainers, the prototype for sceKernelVolatileMemUnlock is wrong. It should be:

Code: Select all

/**
 * Deallocate the extra 4 megs of RAM
 *
 * @param unk - Set to 0, otherwise it fails in 3.52+, possibly earlier
 * @return 0 on success
 */
int sceKernelVolatileMemUnlock&#40;int unk&#41;;
aTomIC
Posts: 35
Joined: Tue Aug 28, 2007 9:18 pm
Contact:

Post by aTomIC »

crazyc wrote:
What should i do with exception.prx and fixup.prx?
Put them in the same directory as EBOOT.PBP.
And then, it works on FW3.xx?

Edit:
I better should read your first post before i ask. Sorry. I put both file into the package.
Image
Wraggster
Posts: 121
Joined: Fri Aug 26, 2005 7:40 am
Contact:

Post by Wraggster »

thanks for the release crazyC :)
Webmaster of http://www.dcemu.co.uk

DCEMU The Worlds Only Homebrew & Gaming Network of Sites.
Chrighton
Posts: 58
Joined: Wed Jun 15, 2005 8:24 pm

Post by Chrighton »

Thanks for the new release and the exception handler stuff (I was interested in this as well), crazyc.
IM back!
Posts: 44
Joined: Tue Apr 17, 2007 9:53 pm

Post by IM back! »

finaly a new thread! ill post my read me asap.
sorry for spelling!
SamuraiX
Posts: 76
Joined: Tue Jan 31, 2006 6:28 am
Location: USA
Contact:

Post by SamuraiX »

Would you happen to have the whole source for exception.prx meaning the *.c, *.S and whatever else is required to compile it?

I did try out the prx and found all I got was blank screen when I caused an exception on purpose with my app.
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

The exception handler is really great! What does the fixup.prx do exactly?
crazyc
Posts: 408
Joined: Fri Jun 17, 2005 10:13 am

Post by crazyc »

SamuraiX wrote:Would you happen to have the whole source for exception.prx meaning the *.c, *.S and whatever else is required to compile it?
All that's needed is the above and the basic exports.exp and the Makefile.
exports.exp

Code: Select all

PSP_BEGIN_EXPORTS
PSP_EXPORT_START&#40;syslib, 0, 0x8000&#41;
PSP_EXPORT_FUNC_HASH&#40;module_start&#41;
PSP_EXPORT_VAR_HASH&#40;module_info&#41;
PSP_EXPORT_END

PSP_END_EXPORTS
Makefile

Code: Select all

TARGET = exception
OBJS = main.o exception_asm.o

# Define to build this as a prx &#40;instead of a static elf&#41;
BUILD_PRX=1
# Define the name of our custom exports &#40;minus the .exp extension&#41;
PRX_EXPORTS=exports.exp

USE_KERNEL_LIBC = 1
USE_KERNEL_LIBS = 1

INCDIR = 
CFLAGS = -Os -G0 -Wall  -nostartfiles
CXXFLAGS = $&#40;CFLAGS&#41; -fno-exceptions -fno-rtti
ASFLAGS = $&#40;CFLAGS&#41;

LIBDIR =

PSPSDK=$&#40;shell psp-config --pspsdk-path&#41;
include $&#40;PSPSDK&#41;/lib/build.mak
SamuraiX wrote:I did try out the prx and found all I got was blank screen when I caused an exception on purpose with my app.
Use it like this:

Code: Select all

void trap_handler&#40;PspDebugRegBlock *regs&#41;;
PspDebugRegBlock exception_regs;

void start_handler&#40;&#41; &#123;
   SceKernelLMOption option;
	char path&#91;MAXPATHLEN&#93;;
	int args&#91;2&#93;, fd, modid;

	memset&#40;&option, 0, sizeof&#40;option&#41;&#41;;
	option.size = sizeof&#40;option&#41;;
	option.mpidtext = PSP_MEMORY_PARTITION_KERNEL;
	option.mpiddata = PSP_MEMORY_PARTITION_KERNEL;
	option.position = 0;
	option.access = 1;

	if&#40;realpath&#40;"exception.prx", path&#41; && &#40;&#40;modid = sceKernelLoadModule&#40;path, 0, &option&#41;&#41; >= 0&#41;&#41; &#123;
		args&#91;0&#93; = &#40;int&#41;trap_handler;
		args&#91;1&#93; = &#40;int&#41;&exception_regs;
		sceKernelStartModule&#40;modid, 8, args, &fd, NULL&#41;;
	&#125;
&#125;
The exception handler is really great! What does the fixup.prx do exactly?
Low level ugly things...

Code: Select all

#include <pspkernel.h>

PSP_MODULE_INFO&#40;"fixup", 0x1000, 1, 1&#41;;

int module_start&#40;SceSize args, void *argp&#41;
&#123;
	sceKernelSetDdrMemoryProtection&#40;&#40;void *&#41;0x88300000, 1024*1024, 0xf&#41;;	// this is unmixed on 3.7
	*&#40;int *&#41;0xBC100050 &= ~1;	// kill the me so it doesn't mess with the code cache
					// do it directly to avoid 3.7 nid issues
	*&#40;int *&#41;0xBC000030 |= 0x300;	// allow user access to the profiler &#40;0x5c4xxxxx&#41;
					// hope this works on the slim
	return -1;
&#125;
SamuraiX
Posts: 76
Joined: Tue Jan 31, 2006 6:28 am
Location: USA
Contact:

Post by SamuraiX »

ok... so trap_handler == MyExceptionHandler in the samples directories. However, when I perform use pspDebugDumpException(regs) the PSP returns automatically to the XMB and never starts up the app. I get error: 8002013C

Otherwise everything seems to be working so far, but no exception data obviously because I comment pspDebugDumpException(regs) out and but I do see the lovely BSOD as I should.


{edit}


After a little more researching and searching I've got it to work. Again I want to thank You so much crazyc!!! Here it is if anyone else wants to know how it works.

Code: Select all

static const char *codeTxt&#91;32&#93; = 
&#123;
    "Interrupt", "TLB modification", "TLB load/inst fetch", "TLB store",
    "Address load/inst fetch", "Address store", "Bus error &#40;instr&#41;", 
    "Bus error &#40;data&#41;", "Syscall", "Breakpoint", "Reserved instruction", 
    "Coprocessor unusable", "Arithmetic overflow", "Unknown 14",
	"Unknown 15", "Unknown 16", "Unknown 17", "Unknown 18", "Unknown 19",
	"Unknown 20", "Unknown 21", "Unknown 22", "Unknown 23", "Unknown 24",
	"Unknown 25", "Unknown 26", "Unknown 27", "Unknown 28", "Unknown 29",
	"Unknown 31"
&#125;;

static const unsigned char regName&#91;32&#93;&#91;5&#93; =
&#123;
    "zr", "at", "v0", "v1", "a0", "a1", "a2", "a3",
    "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", 
    "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7",
    "t8", "t9", "k0", "k1", "gp", "sp", "fp", "ra"
&#125;;

void ExceptionHandler&#40;PspDebugRegBlock * regs&#41;
&#123;
	int i;
	pspDebugScreenInit&#40;&#41;;
    pspDebugScreenSetBackColor&#40;0x00FF0000&#41;;
    pspDebugScreenSetTextColor&#40;0xFFFFFFFF&#41;;
    pspDebugScreenClear&#40;&#41;;
    pspDebugScreenPrintf&#40;"Your PSP has just crashed!\n"&#41;;
    pspDebugScreenPrintf&#40;"Exception details&#58;\n\n"&#41;;
    pspDebugScreenPrintf&#40;"Exception - %s\n", codeTxt&#91;&#40;regs->cause >> 2&#41; & 31&#93;&#41;;
    pspDebugScreenPrintf&#40;"EPC       - %08X\n", &#40;int&#41;regs->epc&#41;;
    pspDebugScreenPrintf&#40;"Cause     - %08X\n", &#40;int&#41;regs->cause&#41;;
    pspDebugScreenPrintf&#40;"Status    - %08X\n", &#40;int&#41;regs->status&#41;;
    pspDebugScreenPrintf&#40;"BadVAddr  - %08X\n", &#40;int&#41;regs->badvaddr&#41;;
    for&#40;i=0; i<32; i+=4&#41; pspDebugScreenPrintf&#40;"%s&#58;%08X %s&#58;%08X %s&#58;%08X %s&#58;%08X\n", regName&#91;i&#93;, &#40;int&#41;regs->r&#91;i&#93;, regName&#91;i+1&#93;, &#40;int&#41;regs->r&#91;i+1&#93;, regName&#91;i+2&#93;, &#40;int&#41;regs->r&#91;i+2&#93;, regName&#91;i+3&#93;, &#40;int&#41;regs->r&#91;i+3&#93;&#41;;
    pspDebugScreenPrintf&#40;"\n\nWill exit to PSP menu in 10 seconds..."&#41;;
	sceKernelDelayThread&#40;10*1000000&#41;;
	sceKernelExitGame&#40;&#41;;
&#125;

void initExceptionHandler&#40;&#41; 
&#123;
   SceKernelLMOption option;
   int args&#91;2&#93;, fd, modid;

   memset&#40;&option, 0, sizeof&#40;option&#41;&#41;;
   option.size = sizeof&#40;option&#41;;
   option.mpidtext = PSP_MEMORY_PARTITION_KERNEL;
   option.mpiddata = PSP_MEMORY_PARTITION_KERNEL;
   option.position = 0;
   option.access = 1;

   if&#40;&#40;modid = sceKernelLoadModule&#40;"/Modules/exception.prx", 0, &option&#41;&#41; >= 0&#41;
   &#123;
      args&#91;0&#93; = &#40;int&#41;ExceptionHandler;
      args&#91;1&#93; = &#40;int&#41;&exception_regs;
      sceKernelStartModule&#40;modid, 8, args, &fd, NULL&#41;;
   &#125;
&#125;
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

crazyc wrote:If you are using the code straight from libpspdebug, be sure you put a nop after "beq $a0, $0, 1f" otherwise, if cop1 is disabled, you will get a coprocessor unusable fault in exception mode.
crazyc wrote:BTW, for the pspsdk maintainers, the prototype for sceKernelVolatileMemUnlock is wrong.
both fixed in rev 2351, thanks
hlide
Posts: 739
Joined: Sun Sep 10, 2006 2:31 am

Post by hlide »

crazyc, what's the real purpose and the meaning of : "sceKernelSetDdrMemoryProtection((void *)0x88300000, 1024*1024, 0xf); // this is unmixed on 3.7" ? you mean this area was "userphile" before 3.7 ? this area can be used by an application without any problem ?

i'm also attempted to use 0x88400000-0x88800000, is there any strong reason not to mess with ?

thanx for your PRXs and your source sharing.
Murdock
Posts: 110
Joined: Sun May 21, 2006 2:14 am

Post by Murdock »

hmm, this release is causing problems ...


... I copy it onto my PSP with the prx files and my Dosbox.conf and as soon as I start a game, for example Warcraft, it switches off my PSP.

Did I do sth. wrong? I even tried it in Game150 folder and Game 371 ... always the same problem!

Kinda strange. I even tried aTomic's version, which is generally exactly the same as crazyc's, just with a config file, but it causes the same error.
KickinAezz
Posts: 328
Joined: Sun Jun 03, 2007 10:05 pm

Post by KickinAezz »

The OSK is very Horrible.

Honestly, It took me 4 mins 15 seconds to type "help /all"

Why not implement Danzeff's or someone's?


-
And, how to use those patches?
Intrigued by PSP system Since December 2006.
Use it more for Development than for Gaming.
crazyc
Posts: 408
Joined: Fri Jun 17, 2005 10:13 am

Post by crazyc »

hlide wrote:you mean this area was "userphile" before 3.7 ? this area can be used by an application without any problem ?
I mean the nid is the same in 3.71 as in earlier kernels.
hlide wrote:i'm also attempted to use 0x88400000-0x88800000, is there any strong reason not to mess with ?
I've never looked at it myself, but some people have suggested that area is overwritten when the PSP is put to sleep, so you should put only volatile data there.
... I copy it onto my PSP with the prx files and my Dosbox.conf and as soon as I start a game, for example Warcraft, it switches off my PSP.
Do other games work? It's possible the exception handler isn't working right in 3.71.
Why not implement Danzeff's or someone's?
This was argued over several times in the old thread. Any alternative keyboard would need to implement all 101 AT keys (danzeff's doesn't come anywhere near) and be easy to integrate (several were suggested in the old thread which were very closely tied to their apps). The alternatives are to get a ir keyboard or use batch files and keymapping.
Murdock
Posts: 110
Joined: Sun May 21, 2006 2:14 am

Post by Murdock »

... I copy it onto my PSP with the prx files and my Dosbox.conf and as soon as I start a game, for example Warcraft, it switches off my PSP.
Do other games work? It's possible the exception handler isn't working right in 3.71.
Hmm, I've tried several other games. All of them seem to crash :( for example Space Quest 5, Warcraft, Archon Ultra, Battle Isle etc.

Maybe it's a problem with the dosbox.conf *let's hope so :)*... can u post the one u use?




And another question: What about the OSK? How can I activate it?

[/code]
KickinAezz
Posts: 328
Joined: Sun Jun 03, 2007 10:05 pm

Post by KickinAezz »

crazyc wrote:
Why not implement Danzeff's or someone's?
This was argued over several times in the old thread. Any alternative keyboard would need to implement all 101 AT keys (danzeff's doesn't come anywhere near) and be easy to integrate (several were suggested in the old thread which were very closely tied to their apps). The alternatives are to get a ir keyboard or use batch files and keymapping.
Atleast let us choose it, add an option in the config file

danzeff = 1

We can then use keymapping

INPUTMAP key key
INPUTMAP exec gameexe

It makes the experience 400% better and 1000% faster and 1300% less frustrating.

Anyway, it's just a suggestion.

-
Thanks for this, I am able to play Dangerous Dave on my PSP!
Intrigued by PSP system Since December 2006.
Use it more for Development than for Gaming.
crazyc
Posts: 408
Joined: Fri Jun 17, 2005 10:13 am

Post by crazyc »

KickinAezz wrote:Atleast let us choose it, add an option in the config file
It makes the experience 400% better and 1000% faster and 1300% less frustrating.
Perhaps, but I strongly suspect that this would lead to lots of posts asking "how do I press F1" and "how do I press ESC" etc. There are many keys missing from Danzeff that are required to use a very large number of PC apps.
Murdock
Posts: 110
Joined: Sun May 21, 2006 2:14 am

Post by Murdock »

crazyc wrote:
KickinAezz wrote:Atleast let us choose it, add an option in the config file
It makes the experience 400% better and 1000% faster and 1300% less frustrating.
Perhaps, but I strongly suspect that this would lead to lots of posts asking "how do I press F1" and "how do I press ESC" etc. There are many keys missing from Danzeff that are required to use a very large number of PC apps.
Sorry, but again: how do I activate the OSK? :)
crazyc
Posts: 408
Joined: Fri Jun 17, 2005 10:13 am

Post by crazyc »

Murdock wrote:Sorry, but again: how do I activate the OSK? :)
He was talking about keyhint which I suspect you already know about.
Maybe it's a problem with the dosbox.conf *let's hope so :)*... can u post the one u use?
Any conf which works with the last version, should work with this one. Try removing exception.prx and fixup.prx then if it works replace them one at a time.
KickinAezz
Posts: 328
Joined: Sun Jun 03, 2007 10:05 pm

Post by KickinAezz »

crazyc wrote:
KickinAezz wrote:Atleast let us choose it, add an option in the config file
It makes the experience 400% better and 1000% faster and 1300% less frustrating.
Perhaps, but I strongly suspect that this would lead to lots of posts asking "how do I press F1" and "how do I press ESC" etc. There are many keys missing from Danzeff that are required to use a very large number of PC apps.
I donot expect them to know how to do it NOW either!
Neither do I.

And enable it [if the user chooses danzeff = 1] for the console/prompt only.

Not to argue but please kindly consider adding it; my interest in DOS has just begun 30 mins ago! :D
Intrigued by PSP system Since December 2006.
Use it more for Development than for Gaming.
aTomIC
Posts: 35
Joined: Tue Aug 28, 2007 9:18 pm
Contact:

Post by aTomIC »

Also, i've tried the new PSP DOSBox on my PSP (CFW 3.52-4 by M33 aka DAX) with the config file (in the package by me) and Commander Keen 4. CrazyC, you are a hero. I don't know how you get PSP DOSBox faster but Commander Keen 4 run nearly in full speed with sound. I love you ;)

I copied the complete package (eboot.exe + dosbox.conf + exception.prx + fixup.prx + games folder with commander keen 4) to ms0:\psp\game352 and it runs, runs, runs :) - yesterday, i tried the new release in folder ...\game150 and it runs, too. I must say, i did not use any plugins or something. Maybe, these could make errors...

And by the way, happy new year to all!
Image
Eniko
Posts: 6
Joined: Mon Dec 24, 2007 8:08 am

Post by Eniko »

Thanks for the new release. For whatever reason this one seems to run a lot better on my slim.

I'm running into a problem with Ultima6 though, when I try to save:

Code: Select all

DISK ERROR!!!!
Function&#58; 7,
error&#58; 2, file&#58;
savegameobjblkBC.tmp
And that basically corrupts the savegame. Works fine on Dosbox PC. Any ideas what this might be or how it's fixable? I assume it's a problem with writing to the memory stick.
Murdock
Posts: 110
Joined: Sun May 21, 2006 2:14 am

Post by Murdock »

crazyc wrote:
Murdock wrote:Sorry, but again: how do I activate the OSK? :)
He was talking about keyhint which I suspect you already know about.
Maybe it's a problem with the dosbox.conf *let's hope so :)*... can u post the one u use?
Any conf which works with the last version, should work with this one. Try removing exception.prx and fixup.prx then if it works replace them one at a time.
I deleted both of them ... the problem persists ... still my PSP shuts down after selecting a game (like warcraft) ... it already shuts down shortly after selecting the game.

I am not sure whether I tried my dosbox.conf file with the last version. I more or less skipped your last release, since u never told me/us what u changed, except that you've switched to kernel 3.xx and I did not see any speed improvement when I tried it with Warcraft ... I can't remember whether I used a dosbox.conf from the website or mine ...

Nevertheless, it's kinda strange that I get these errors and others don't ...
aTomIC
Posts: 35
Joined: Tue Aug 28, 2007 9:18 pm
Contact:

Post by aTomIC »

@Mr. Murdock
Did you use any plugin or custom things like theme? Switch your psp to original and try the new release again. No plugin or something. It should work.
Image
Murdock
Posts: 110
Joined: Sun May 21, 2006 2:14 am

Post by Murdock »

Just tried using a "plain" dosbox.conf ... without any adjustments by me, found it somewhere in my old folders. But still, the PSP switches off when I load a game ... I'm very clueless ...

Oh, maybe it is of importance: I use CFW 3.71!
Murdock
Posts: 110
Joined: Sun May 21, 2006 2:14 am

Post by Murdock »

aTomIC wrote:@Mr. Murdock
Did you use any plugin or custom things like theme? Switch your psp to original and try the new release again. No plugin or something. It should work.
I know that plugins can cause problems, that's why I'm not using any ... but thx for the hint anyway!

hmm, can a custom theme cause problems? I never had any with my custom ones on Firmware 3.52. There I never used the original themes.

Yes, I'm using a custom theme. But Quake 1 ran with it without any problems a week ago, right after I flashed it. But I'll try n see whether this causes the problem ...
crazyc
Posts: 408
Joined: Fri Jun 17, 2005 10:13 am

Post by crazyc »

Someone sent me a PM asking how to build it so here's an attempt to describe the rather difficult procedure.

1) get dosbox 0.71
2) apply the patch
3) get renderpsp.h and put it in src/gui, get fpu_instructions_vfpu.h and put it in src/fpu, and get p_sprint.h and put it in src/gui
4) install SDL, dosbox-psp doesn't use it but configure requires it for now
5) run configure, I use "CXXFLAGS='-I/usr/local/pspdev/psp/sdk/include -Ic:/pspdev/psp/include/SDL -fomit-frame-pointer -Os -frename-registers -finline -finline-limit=200 -msingle-float -ffast-math fsingle-precision-constant -G0 -I/c/pspdev/psp/include/SDL' LDFLAGS='-lc -lpspuser -lpspkernel -L/usr/local/pspdev/psp/sdk/lib' ./configure --host=psp", but use what ever cflags you want
6) build it, link will fail
7) compile p_sprint.c and ftruncate.c put them in src
8) change to src and link with

Code: Select all

psp-gcc -L/usr/local/pspdev/psp/sdk/lib -o dosbox  dosbox.o ftruncate.o cpu/libcpu.a debug/libdebug.a dos/libdos.a fpu/libfpu.a  hardware/libhardware.a gui/libgui.a ints/libints.a misc/libmisc.a shell/libshell.a -lm hardware/serialport/libserial.a p_sprint.o -lpspdebug -lpspgu -lpspctrl -lpspdisplay -lpspge -lpspsdk -lpsprtc -lpspaudio -lstdc++ -lpspirkeyb -lc -lpspnet -lpspnet_inet -lpsppower -lpsputility -lpspuser -lpspkernel -specs=/usr/local/pspdev/psp/sdk/lib/prxspecs -Wl,-Tc&#58;/pspdev/psp/sdk/lib/linkfile.prx,-q && psp-fixup-imports.exe dosbox && psp-prxgen dosbox dosbox.prx && pack-pbp EBOOT.PBP PARAM.SFO NULL NULL NULL NULL NULL dosbox.prx NULL
There are probably changes i've made to my toolchain that will cause this to fail, so post if there are other problems.
Post Reply