Skip to content

Commit

Permalink
== N64 ==
Browse files Browse the repository at this point in the history
- Added PLUGE
- Added Gray Ramp
- Fixed Scroll help
- Text now has different spacing for special characters
- Fixed help loading when buffer was not empty
  • Loading branch information
ArtemioUrbina committed Jul 26, 2024
1 parent 978c75f commit f331ae1
Show file tree
Hide file tree
Showing 17 changed files with 294 additions and 9 deletions.
6 changes: 6 additions & 0 deletions 240psuite/N64/240pSuite.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,12 @@ void drawPatternsColorMenu(void) {
freeImage(&sd);

switch(sel) {
case 1:
drawPLUGE();
break;
case 7:
drawGrayramp();
break;
case 11:
exit = 1;
break;
Expand Down
5 changes: 5 additions & 0 deletions 240psuite/N64/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,15 @@ filesystem/%.sprite: assets/%.png
@$(N64_MKSPRITE) $(MKSPRITE_FLAGS) -o filesystem "$<"

filesystem/240pSuite-font.sprite: MKSPRITE_FLAGS=--tiles 8,8
filesystem/240pSuite-font480.sprite: MKSPRITE_FLAGS=--tiles 16,16
filesystem/mainbg.sprite: MKSPRITE_FLAGS=--format CI4
filesystem/sd.sprite: MKSPRITE_FLAGS=--format CI4
filesystem/monoscopeFBX.sprite: MKSPRITE_FLAGS=--format CI4
filesystem/monoscope.sprite: MKSPRITE_FLAGS=--format CI4
filesystem/pluge.sprite: MKSPRITE_FLAGS=--format CI4
filesystem/plugePAL.sprite: MKSPRITE_FLAGS=--format CI4
filesystem/PLUGEBorder.sprite: MKSPRITE_FLAGS=--format CI4
filesystem/grayramp.sprite: MKSPRITE_FLAGS=--format CI8
filesystem/grid.sprite: MKSPRITE_FLAGS=--format CI4
filesystem/grid-480.sprite: MKSPRITE_FLAGS=--format CI4
filesystem/donna.sprite: MKSPRITE_FLAGS=--format RGBA16
Expand Down
Binary file added 240psuite/N64/assets/PLUGEBorder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 240psuite/N64/assets/grayramp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 240psuite/N64/assets/pluge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 240psuite/N64/assets/plugePAL.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions 240psuite/N64/filesystem/help/dshadow.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
DROP SHADOW TEST

This is a crucial test for 240p
upscan converters. It displays a
simple sprite shadow against a
background, but the shadow is
shown only on each other frame.

On a CRT this achieves a
transparency effect, since you
are watching a 30hz
(25Hz) shadow on a 60hz (50hz)
signal. No background detail
should be lost and the shadow
should be visible.

The user can toggle the frame
used to draw the shadow with
button #GCL#G. Backgrounds can
be switched with the #GA#G button
and button #GCR#G toggles sprites.
2 changes: 1 addition & 1 deletion 240psuite/N64/filesystem/help/general.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ supports 240p, 288p, 576i and
480i video modes.


#C(cont...)#C
#C(cont...)#C
HELP (2/2)

The #YNintendo 64#Y cuts out a
Expand Down
22 changes: 22 additions & 0 deletions 240psuite/N64/filesystem/help/gray.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
GRAY RAMP

This gray ramp pattern can be
used to check color balance and
to adjust the white level.

You should make sure the bars
are gray, with no red or blue
bias. This can be adjusted with
the individual color settings,
or the #Ytint#Y control in NTSC
displays.

In order to adjust white level,
you need to use the #Ycontrast#Y
control of your TV set. Raise the
contrast to the point where the
white bars on the sides are
undistinguishable from each
other, and then lower it to the
point where you can clearly
identify both.
60 changes: 60 additions & 0 deletions 240psuite/N64/filesystem/help/pluge.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
PLUGE (1/3)

The #Ypicture line-up generation
equipment#Y (PLUGE) is a test
pattern used to adjust the black
level and contrast of a video
signal.

The pattern in this suite is
mainly designed to adjust the
black level. The control for
setting this on your TV is
usually named #YBrightness#Y.

This adjustment ensures that
anything intended to be black is
actually black, and allows all
detail to be seen on dark scenes.

There are three bars at each
side, you can highlight them
with the #GCL#G button.

#C(cont...)#C
PLUGE (2/3)

The #GA#G button changes between
#GNTSC#G and #GRGB Full Range#G [0-255]
when in any NTSC mode.

The values of the bars depend on
your current video mode. Reduce
the #YBrightness#Y until the desired
bars are no longer visible, and
then slowly raise it until they
are #Gjust#G visible, and go back one
notch where they blend with the
background.

For games always use #GRGB Full
Range#G. The 1 IRE bars are the ones
you should calibrate against. The
values of the bars are: 1, 2 and
3.5 IRE.



#C(cont...)#C
PLUGE (3/3)

Values for the bars when in NTSC
mode are: closest to the center
3.5 IRE, central ones 7.5 IRE, and
outer ones 11.5 IRE.

When calibrating for NTSC
material, the 7.5 IRE bars should
blend in the background. The 7.5
IRE in NTSC is the black level,
also known as setup.
23 changes: 23 additions & 0 deletions 240psuite/N64/filesystem/help/scroll.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
SCROLL TEST

This test shows a two layer
background from #YSonic the
Hedgehog#Y or a single one from
#YKiki Kaikai#Y.

The speed can be varied with the
d-pad, and direction changed with
button #GX#G.

Vertical and horizntal patterns
can be swapped with the #GY#G button,
and #GA#G stops the scroll.

This can be used to notice any
drops in framerate when using
a video processor.

#YSonic The Hedgehog#Y is a trademark
of #YSega Enterprises Ltd#Y.
#YKiki Kaikai#Y is a trademark of
#YNamco/Bandai#Y.
38 changes: 35 additions & 3 deletions 240psuite/N64/font.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,41 @@ void graphics_draw_text_suite( surface_t* disp, int x, int y, const char * const
}
graphics_set_color(f_color, 0x00000000);
break;
default:
graphics_draw_character( disp, tx, ty, *text );
tx += fw;
default: {
bool shown = false;

// show ... as three dots with less spacing
if(*text == '.' && *(text + 1) != '\0') {
if(*(text + 1) == '.' && *(text + 1) == *(text + 2)) {
int stride = lh;

tx -= fw/4;
for(int pos = 0; pos < 3; pos++) {
graphics_draw_character(disp, tx, ty, '.');
tx += stride;
}
tx += fw/4;
shown = true;
text += 2;
}
}

// show some characters with less spacing
if(!shown) {
if(*text == '.' || *text == ',' || *text == ';' ||
*text == '\'') {
tx = tx - fw/2 + 1;
graphics_draw_character(disp, tx, ty, *text);
tx += fw/2 + 1;
} else if(*text == ':' || *text == '/') {
graphics_draw_character(disp, tx, ty, *text);
tx += lh;
} else { // any regular character
graphics_draw_character(disp, tx, ty, *text);
tx += fw;
}
}
}
break;
}

Expand Down
2 changes: 1 addition & 1 deletion 240psuite/N64/help.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ char *loadHelpFile(char *filename, char ***pages, int *npages) {
return NULL;
}

memset(buffer, 0x20, size);
memset(buffer, 0x00, size);

if(dfs_read(buffer, 1, size, fp) < 0) {
dfs_close(fp);
Expand Down
2 changes: 1 addition & 1 deletion 240psuite/N64/help.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ extern char *helpData;
#define DROPSHADOW "/help/dshadow.txt"
#define STRIPED "/help/striped.txt"
#define GRIDSCROLL "/help/gridscroll.txt"
#define SCROLL "/help/scroll.txt"
#define SCROLLHELP "/help/scroll.txt"
#define MANUALLAG "/help/manuallag.txt"
#define PASSIVELAG "/help/passivelag.txt"
#define SMPTECOLOR "/help/SMPTEColor.txt"
Expand Down
114 changes: 114 additions & 0 deletions 240psuite/N64/patterns.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,89 @@
#include "patterns.h"
#include "menu.h"

void drawPLUGE() {
int end = 0, type = 0, showBorder = 0, showText = 0;
image *back = NULL, *pal = NULL, *borderGreen = NULL, *borderRed = NULL;
joypad_buttons_t keys;
char msg[50];

back = loadImage("rom:/pluge.sprite");
if(!back)
return;
pal = loadImage("rom:/plugePAL.sprite");
if(!pal)
return;
borderGreen = loadImage("rom:/PLUGEBorder.sprite");
if(!borderGreen)
return;
borderRed = loadImage("rom:/PLUGEBorder.sprite");
if(!borderRed)
return;
borderGreen->palette[1] = graphics_make_color(0xff, 0x00, 0x00, 0xff);
data_cache_hit_writeback_invalidate(borderGreen->palette, sizeof(uint16_t)*borderGreen->palSize);
borderRed->palette[1] = graphics_make_color(0x00, 0xff, 0x00, 0xff);
data_cache_hit_writeback_invalidate(borderRed->palette, sizeof(uint16_t)*borderRed->palSize);

while(!end) {
getDisplay();

rdpqStart();

if(type)
rdpqDrawImage(back);
else
rdpqDrawImage(pal);
if(showBorder) {
rdpqDrawImageXY(borderRed, 14, 39);
rdpqDrawImageXY(borderRed, 44, 39);
rdpqDrawImageXY(borderGreen, 74, 39);

rdpqDrawImageXY(borderGreen, 228, 39);
rdpqDrawImageXY(borderRed, 259, 39);
rdpqDrawImageXY(borderRed, 289, 39);
}
rdpqEnd();

if(showBorder) {
drawString(10, 205, 0xff, 0x00, 0, type ? "11.5" : "3.5");
drawString(40, 205, 0xff, 0x00, 0, type ? "7.5" : "2");
drawString(70, 205, 0xff, 0x00, 0, type ? "3.5" : "1");

drawString(224, 205, 0xff, 0x00, 0, type ? "3.5" : "1");
drawString(255, 205, 0xff, 0x00, 0, type ? "7.5" : "2");
drawString(285, 205, 0xff, 0x00, 0, type ? "11.5" : "3.5");
showBorder --;
}

if(showText) {
drawString(200, 20, 0, 0xff, 0, msg);
showText --;
}

checkMenu(PLUGEHELP, NULL);
waitVsync();

joypad_poll();
keys = controllerButtonsHeld();

checkStart(keys);
if(keys.a) {
type = !type;
sprintf(msg, type ? "NTSC 7.5 IRE" : "RGB Full Range");
showText = 60;
}
if(keys.c_left)
showBorder = 60;
if(keys.b)
end = 1;
}

freeImage(&borderGreen);
freeImage(&borderRed);
freeImage(&pal);
freeImage(&back);
}

void drawMonoscope() {
int end = 0, pattern = 0;
image *back = NULL, *orig = NULL;
Expand Down Expand Up @@ -116,3 +199,34 @@ void drawGrid() {

freeImage(&back);
}


void drawGrayramp() {
int end = 0;
image *back = NULL;
joypad_buttons_t keys;

back = loadImage("rom:/grayramp.sprite");
if(!back)
return;
while(!end) {
getDisplay();

rdpqStart();

rdpqDrawImage(back);
rdpqEnd();

checkMenu(GRAYHELP, NULL);
waitVsync();

joypad_poll();
keys = controllerButtonsHeld();

checkStart(keys);
if(keys.b)
end = 1;
}

freeImage(&back);
}
2 changes: 2 additions & 0 deletions 240psuite/N64/patterns.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#ifndef PATTERNS_H
#define PATTERNS_H

void drawPLUGE();
void drawMonoscope();
void drawGrid();
void drawGrayramp();

#endif
6 changes: 3 additions & 3 deletions 240psuite/N64/tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,11 @@ void drawScroll() {
rdpqEnd();

#ifdef DEBUG_BENCHMARK
//printPalette(sonicFall, 20, 20);
//printPalette(sonicWater, 100, 20);
printPalette(sonicFall, 20, 20);
printPalette(sonicWater, 100, 20);
#endif

checkMenu(NULL, NULL);
checkMenu(SCROLLHELP, NULL);
waitVsync();

joypad_poll();
Expand Down

0 comments on commit f331ae1

Please sign in to comment.