cubic.org > doj > Sony PlayStation 3

Sony PlayStation 3

This page collects various information on my use of the Sony PlayStation 3. To check which games I've played, look at dojcubic's PlayStation Network profile.

Cronus Zen scripts

I'm using the Cronus Zen to modify my Dualshock 3 controller behavior for some games on the PlayStation 3. I mainly use it to invert the X and Y axis of the right analog stick, as this is my preferred way of controlling a camera.

I've noticed the following issues with the Cronus Zen software (firmware) as of 2021:

Grand Theft Auto V


// invert right stick for GTA V on Playstation
// https://beta.cronusmax.com/gpc
// https://www.cubic.org/~doj/ps3/

int MY_L1 = PS3_L1;
int MY_DOWN = PS3_DOWN;
int MY_RX = PS3_RX;
int MY_RY = PS3_RY;

int image_invert = 0;
int image_invert_timer = 0;
define data_width   = 9; // number of bytes in the data section for each image row
define image_width  = 72; // image width in pixels
define image_height = 62; // image height in pixels
data(255,255,255,255,255,63,224,255,255,
255,255,255,255,255,63,192,255,255,
255,255,255,255,255,63,199,255,255,
7,0,96,0,0,6,199,255,255,
1,0,0,0,0,0,199,255,255,
241,231,15,63,142,240,199,255,255,
248,231,159,127,254,249,199,255,255,
248,231,159,127,254,249,199,255,255,
56,231,156,115,206,57,199,255,255,
56,231,28,112,206,57,199,255,255,
56,231,31,127,206,57,199,255,255,
56,231,159,127,206,57,199,255,255,
56,231,159,127,206,57,199,255,255,
56,231,156,115,206,57,199,255,255,
56,231,156,115,206,57,199,255,255,
248,231,156,127,206,249,199,255,255,
248,231,156,127,206,249,199,255,255,
248,231,156,127,206,249,199,255,255,
0,231,28,0,0,0,192,255,255,
128,7,252,3,0,0,224,255,255,
248,7,252,227,255,255,7,248,255,
248,231,252,3,0,0,0,0,255,
0,224,128,3,0,0,192,1,255,
0,224,128,127,254,249,199,1,255,
255,249,159,127,254,249,231,63,255,
255,249,159,119,222,121,224,63,255,
255,225,128,115,206,57,192,1,255,
255,225,128,115,206,249,199,1,255,
255,227,156,115,254,249,199,57,255,
255,227,156,115,254,121,192,57,255,
255,227,156,115,14,56,192,57,255,
255,227,156,115,14,56,192,57,255,
255,227,156,115,206,57,199,57,255,
255,227,159,115,254,57,199,63,255,
255,231,159,115,254,57,207,63,255,
3,0,0,0,0,0,0,0,0,
1,0,0,0,0,0,0,0,0,
248,241,142,3,252,255,255,252,63,
252,247,222,127,126,0,128,4,32,
252,247,222,127,254,3,240,60,56,
188,247,222,127,206,7,16,32,12,
128,247,158,3,206,25,16,32,244,
248,247,158,115,206,49,240,63,254,
252,247,158,115,206,33,63,226,251,
252,247,158,115,206,225,71,247,249,
188,247,158,115,206,33,238,26,253,
188,247,158,115,206,184,239,218,241,
252,247,159,127,254,60,239,157,247,
252,247,159,127,126,190,199,221,231,
248,231,15,127,124,190,255,31,207,
1,0,0,0,0,190,3,240,223,
3,0,96,0,1,254,1,64,222,
255,255,255,255,255,62,1,224,222,
255,255,255,255,255,190,1,224,220,
255,255,255,255,255,190,3,240,221,
255,255,255,255,255,222,7,240,221,
255,255,255,255,255,222,7,248,217,
255,255,255,255,255,237,15,252,227,
255,255,255,255,255,243,15,252,255,
255,255,255,255,255,255,31,252,255,
255,255,255,255,255,255,31,254,255,
255,255,255,255,255,255,63,254,255
);

const string s_ps3_controller     = "PS3 c";
const string s_ps4_controller     = "PS4 c";
const string s_ps5_controller     = "PS5 c";
const string s_xb360_controller   = "XB360 c";
const string s_xb1_controller     = "XB1 c";
const string s_wii_controller     = "Wii c";
const string s_switch_controller  = "Swtch c";
const string s_unknown_controller = "unkwn c";

const string s_playstation3    = "PS3";
const string s_playstation4    = "PS4";
const string s_playstation5    = "PS5";
const string s_xb360           = "XBox360";
const string s_xb1             = "XBoxOne";
const string s_wii             = "Wii";
const string s_switch          = "Switch";
const string s_unknown_console = "unknown";

init {
	cls_oled(OLED_BLACK);

	if (get_controller() == PIO_PS3)
	{
		print(0,0,OLED_FONT_SMALL,OLED_WHITE,s_ps3_controller[0]);
	}
	else if (get_controller() == PIO_PS4)
	{
		MY_L1 = PS4_L1;
		MY_DOWN = PS4_DOWN;
		MY_RX = PS4_RX;
		MY_RY = PS4_RY;
		print(0,0,OLED_FONT_SMALL,OLED_WHITE,s_ps4_controller[0]);
	}
	else if (get_controller() == PIO_PS5)
	{
		MY_L1 = PS5_L1;
		MY_DOWN = PS5_DOWN;
		MY_RX = PS5_RX;
		MY_RY = PS5_RY;
		print(0,0,OLED_FONT_SMALL,OLED_WHITE,s_ps5_controller[0]);
	}
	else if (get_controller() == PIO_XB360)
	{
		print(0,0,OLED_FONT_SMALL,OLED_WHITE,s_xb360_controller[0]);
	}
	else if (get_controller() == PIO_XB1)
	{
		print(0,0,OLED_FONT_SMALL,OLED_WHITE,s_xb1_controller[0]);
	}
	else if (get_controller() == PIO_WII)
	{
		print(0,0,OLED_FONT_SMALL,OLED_WHITE,s_wii_controller[0]);
	}
	else if (get_controller() == PIO_SWITCH)
	{
		print(0,0,OLED_FONT_SMALL,OLED_WHITE,s_switch_controller[0]);
	}
	else
	{
		print(0,0,OLED_FONT_SMALL,OLED_WHITE,s_unknown_controller[0]);
	}

	if (get_console() == PIO_PS3)
	{
		print(0,10,OLED_FONT_SMALL,OLED_WHITE,s_playstation3[0]);
	}
	else if (get_console() == PIO_PS4)
	{
		print(0,10,OLED_FONT_SMALL,OLED_WHITE,s_playstation4[0]);
	}
	else if (get_console() == PIO_PS5)
	{
		print(0,10,OLED_FONT_SMALL,OLED_WHITE,s_playstation5[0]);
	}
	else if (get_console() == PIO_XB360)
	{
		print(0,10,OLED_FONT_SMALL,OLED_WHITE,s_xb360[0]);
	}
	else if (get_console() == PIO_XB1)
	{
		print(0,10,OLED_FONT_SMALL,OLED_WHITE,s_xb1[0]);
	}
	else if (get_console() == PIO_WII)
	{
		print(0,10,OLED_FONT_SMALL,OLED_WHITE,s_wii[0]);
	}
	else if (get_console() == PIO_SWITCH)
	{
		print(0,10,OLED_FONT_SMALL,OLED_WHITE,s_switch[0]);
	}
	else if (get_console() == PIO_AUTO)
	{
		print(0,10,OLED_FONT_SMALL,OLED_WHITE,s_unknown_console[0]);
	}
	else
	{
		print(0,10,OLED_FONT_SMALL,OLED_WHITE,s_unknown_console[0]);
	}

	draw_image(OLED_WIDTH-image_width, (OLED_HEIGHT-image_height)/2, image_invert);
}

main {

	// detect weapon wheel
	if (get_val(MY_L1) &&
	    get_ptime(MY_L1) > 500)
	{
	    // do nothing to right stick
	}

	// detect character switch
	else if (get_val(MY_DOWN) &&
	         get_ptime(MY_DOWN) > 500)
	{
		// do nothing to right stick
	}
	else
	{
       	// invert right stick
		set_val(MY_RX, inv(get_val(MY_RX)));
		set_val(MY_RY, inv(get_val(MY_RY)));
	}

	image_invert_timer += get_rtime();
	if (image_invert_timer > 10000)
	{
		image_invert_timer = 0;
		image_invert++;
		image_invert = image_invert & 1;
		draw_image(OLED_WIDTH-image_width, (OLED_HEIGHT-image_height)/2, image_invert);
	}
}

// @return OLED_WHITE if @p val is TRUE  and @p invert is FALSE.
// @return OLED_BLACK if @p val is FALSE and @p invert is FALSE.
// @return OLED_BLACK if @p val is TRUE  and @p invert is TRUE.
// @return OLED_WHITE if @p val is FALSE and @p invert is TRUE.
function pixel_invert(val, invert)
{
	if (invert)
	{
		if (val)
		{
			return OLED_BLACK;
		}
		return OLED_WHITE;
	}
	if (val)
	{
		return OLED_WHITE;
	}
	return OLED_BLACK;
}

int image_x; // variable used by draw_image()
int image_y; // variable used by draw_image()
// draw the image defined in the data() section to the OLED display
// @param pos_x top left X position
// @param pos_y top left Y position
// @param invert if FALSE draw the image as defined in the data() section,
//               if TRUE draw an inverted image.
function draw_image(pos_x, pos_y, invert)
{
	for(image_y = 0; image_y < image_height; image_y++)
	{
		for(image_x = 0; image_x < image_width; image_x++)
		{
  			pixel_oled(pos_x+image_x,
  			           pos_y+image_y,
  			           pixel_invert(test_bit(duint8(image_y*data_width + (image_x >> 3)),
  			                                 image_x & 7),
  			                        invert));
  		}
	}
}

invert right stick axis

The following script is always inverting the right stick axis. When SELECT/SHARE + Triangle + Circle are pressed, enable or disable the inversion. I've used this in games like Call of Duty.


// invert right stick on Playstation
// https://beta.cronusmax.com/gpc
// https://www.cubic.org/~doj/ps3/

int MY_RX = PS3_RX;
int MY_RY = PS3_RY;
int enabled = TRUE;
int rumble_timer = 0;

const string s_ps3_controller = "PS3 Controller";
const string s_ps4_controller = "PS4 Controller";
const string s_ps5_controller = "PS5 Controller";
const string s_xb360_controller = "Xbox360 Controller";
const string s_xb1_controller = "XboxOne Controller";
const string s_wii_controller = "Wii Controller";
const string s_switch_controller = "Switch Controller";
const string s_unknown_controller = "unknown Controller";

const string s_playstation3 = "PlayStation3";
const string s_playstation4 = "PlayStation4";
const string s_playstation5 = "PlayStation5";
const string s_xb360 = "XBox360";
const string s_xb1 = "XBoxOne";
const string s_wii = "Nintendo Wii";
const string s_switch = "Nintendo Switch";
const string s_unknown_console = "unknown console";

const string s_inverted = "inverted";
const string s_normal   = "normal  ";

init {
	cls_oled(OLED_BLACK);

	if (get_controller() == PIO_PS3)
	{
		MY_RX = PS3_RX;
		MY_RY = PS3_RY;
		print(0,0,OLED_FONT_SMALL,OLED_WHITE,s_ps3_controller[0]);
	}
	else if (get_controller() == PIO_PS4)
	{
		MY_RX = PS4_RX;
		MY_RY = PS4_RY;
		print(0,0,OLED_FONT_SMALL,OLED_WHITE,s_ps4_controller[0]);
	}
	else if (get_controller() == PIO_PS5)
	{
		MY_RX = PS5_RX;
		MY_RY = PS5_RY;
		print(0,0,OLED_FONT_SMALL,OLED_WHITE,s_ps5_controller[0]);
	}
	else if (get_controller() == PIO_XB360)
	{
		print(0,0,OLED_FONT_SMALL,OLED_WHITE,s_xb360_controller[0]);
	}
	else if (get_controller() == PIO_XB1)
	{
		print(0,0,OLED_FONT_SMALL,OLED_WHITE,s_xb1_controller[0]);
	}
	else if (get_controller() == PIO_WII)
	{
		print(0,0,OLED_FONT_SMALL,OLED_WHITE,s_wii_controller[0]);
	}
	else if (get_controller() == PIO_SWITCH)
	{
		print(0,0,OLED_FONT_SMALL,OLED_WHITE,s_switch_controller[0]);
	}
	else
	{
		print(0,0,OLED_FONT_SMALL,OLED_WHITE,s_unknown_controller[0]);
	}

	if (get_console() == PIO_PS3)
	{
		print(0,10,OLED_FONT_SMALL,OLED_WHITE,s_playstation3[0]);
	}
	else if (get_console() == PIO_PS4)
	{
		print(0,10,OLED_FONT_SMALL,OLED_WHITE,s_playstation4[0]);
	}
	else if (get_console() == PIO_PS5)
	{
		print(0,10,OLED_FONT_SMALL,OLED_WHITE,s_playstation5[0]);
	}
	else if (get_console() == PIO_XB360)
	{
		print(0,10,OLED_FONT_SMALL,OLED_WHITE,s_xb360[0]);
	}
	else if (get_console() == PIO_XB1)
	{
		print(0,10,OLED_FONT_SMALL,OLED_WHITE,s_xb1[0]);
	}
	else if (get_console() == PIO_WII)
	{
		print(0,10,OLED_FONT_SMALL,OLED_WHITE,s_wii[0]);
	}
	else if (get_console() == PIO_SWITCH)
	{
		print(0,10,OLED_FONT_SMALL,OLED_WHITE,s_switch[0]);
	}
	else if (get_console() == PIO_AUTO)
	{
		print(0,10,OLED_FONT_SMALL,OLED_WHITE,s_unknown_console[0]);
	}
	else
	{
		print(0,10,OLED_FONT_SMALL,OLED_WHITE,s_unknown_console[0]);
	}

	print(0,20,OLED_FONT_SMALL,OLED_WHITE,s_inverted[0]);
}

main {
	if (enabled)
	{
   		// invert right stick
		set_val(MY_RX, inv(get_val(MY_RX)));
		set_val(MY_RY, inv(get_val(MY_RY)));
	}

	if (rumble_timer > 0)
	{
		rumble_timer += get_rtime();
		if (rumble_timer > 700)
		{
			rumble_timer = 0;
			set_rumble(RUMBLE_A,0);
			reset_rumble();
		}
	}

	// when SELECT/SHARE + Triangle + Circle are pressed,
	// enable or disable the inversion.
	if (get_val(PS3_SELECT) // same as PS4_SHARE
		&& get_val(PS3_TRIANGLE)
		&& get_lval(PS3_CIRCLE)
		&& !get_val(PS3_CIRCLE))
	{
		enabled = !enabled;
		if (enabled)
		{
			print(0,20,OLED_FONT_SMALL,OLED_WHITE,s_inverted[0]);
		}
		else
		{
			print(0,20,OLED_FONT_SMALL,OLED_WHITE,s_normal[0]);
		}

		set_rumble(RUMBLE_A,40); // 50%
		rumble_timer = 1;
	}
}

convert left stick to D-pad

The following program converts the left (analog) stick to D-pad button presses. I'm using this when playing Playstation 1 games on the Playstation 3, where I control the character with the stick while the game only accepts input from the D-pad.


// convert left stick to D-pad
// https://beta.cronusmax.com/gpc
// https://www.cubic.org/~doj/ps3/

main
{
	stick2dpad(PS3_LX, PS3_RIGHT, PS3_LEFT);
	stick2dpad(PS3_LY, PS3_DOWN, PS3_UP);
}

function stick2dpad(stick, pad1, pad2)
{
	if (get_val(stick) > 50)
	{
		set_val(pad1, 100);
		set_val(pad2, 0);
	}
	else if (get_val(stick) < -50)
	{
		set_val(pad1, 0);
		set_val(pad2, 100);
	}
}

image conversion program

I've written a simple C++ program to convert a pixel image file to a GPC data() section. You find the program on Github doj/image2gpc.

Links

github:Linux PS3 ISO Tools
github:webMAN MOD releases