forked from len0rd/rockbox
Patch #4864 by Jonathan Gordon: text editor plugin, with some changes by me.
Also correct a var clash between the rockbox's gui api and doom plugin git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9451 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
defbc69b2b
commit
38deb8f13a
13 changed files with 549 additions and 42 deletions
|
|
@ -140,7 +140,7 @@ static int wipe_doMelt(int width, int height, int ticks)
|
|||
return done;
|
||||
}
|
||||
|
||||
// CPhipps - modified to allocate and deallocate screens[2 to 3] as needed, saving memory
|
||||
// CPhipps - modified to allocate and deallocate d_screens[2 to 3] as needed, saving memory
|
||||
|
||||
static int wipe_exitMelt(int width, int height, int ticks)
|
||||
{
|
||||
|
|
@ -152,20 +152,20 @@ static int wipe_exitMelt(int width, int height, int ticks)
|
|||
free(wipe_scr_end);
|
||||
// Paranoia
|
||||
y = NULL;
|
||||
wipe_scr_start = wipe_scr_end = screens[SRC_SCR] = screens[DEST_SCR] = NULL;
|
||||
wipe_scr_start = wipe_scr_end = d_screens[SRC_SCR] = d_screens[DEST_SCR] = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wipe_StartScreen(int x, int y, int width, int height)
|
||||
{
|
||||
wipe_scr_start = screens[SRC_SCR] = malloc(SCREENWIDTH * SCREENHEIGHT);
|
||||
wipe_scr_start = d_screens[SRC_SCR] = malloc(SCREENWIDTH * SCREENHEIGHT);
|
||||
V_CopyRect(x, y, 0, width, height, x, y, SRC_SCR, VPT_NONE ); // Copy start screen to buffer
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wipe_EndScreen(int x, int y, int width, int height)
|
||||
{
|
||||
wipe_scr_end = screens[DEST_SCR] = malloc(SCREENWIDTH * SCREENHEIGHT);
|
||||
wipe_scr_end = d_screens[DEST_SCR] = malloc(SCREENWIDTH * SCREENHEIGHT);
|
||||
V_CopyRect(x, y, 0, width, height, x, y, DEST_SCR, VPT_NONE); // Copy end screen to buffer
|
||||
V_CopyRect(x, y, SRC_SCR, width, height, x, y, 0 , VPT_NONE); // restore start screen
|
||||
return 0;
|
||||
|
|
@ -180,7 +180,7 @@ int wipe_ScreenWipe(int x, int y, int width, int height, int ticks)
|
|||
if (!go) // initial stuff
|
||||
{
|
||||
go = 1;
|
||||
wipe_scr = screens[0];
|
||||
wipe_scr = d_screens[0];
|
||||
wipe_initMelt(width, height, ticks);
|
||||
}
|
||||
V_MarkRect(0, 0, width, height); // do a piece of wipe-in
|
||||
|
|
|
|||
|
|
@ -16,7 +16,11 @@
|
|||
* GNU General Public License for more details.
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.4 2006/04/02 20:45:24 kkurbjun
|
||||
* Revision 1.5 2006/04/03 08:51:08 bger
|
||||
* Patch #4864 by Jonathan Gordon: text editor plugin, with some changes by me.
|
||||
* Also correct a var clash between the rockbox's gui api and doom plugin
|
||||
*
|
||||
* Revision 1.4 2006-04-02 20:45:24 kkurbjun
|
||||
* Properly ifdef H300 video code, fix commented line handling rockbox volume
|
||||
*
|
||||
* Revision 1.3 2006-04-02 01:52:44 kkurbjun
|
||||
|
|
@ -336,7 +340,7 @@ void I_FinishUpdate (void)
|
|||
*(volatile unsigned short *) 0xf0000002 = 0; // value
|
||||
*(volatile unsigned short *) 0xf0000000 = 0x22; // GRAM
|
||||
|
||||
unsigned char *screenptr=screens[0];
|
||||
unsigned char *screenptr=d_screens[0];
|
||||
int wcnt=0, hcnt=0;
|
||||
|
||||
while(hcnt<LCD_HEIGHT)
|
||||
|
|
@ -358,7 +362,7 @@ void I_FinishUpdate (void)
|
|||
{
|
||||
for (x = 0; x < LCD_WIDTH; x++)
|
||||
{
|
||||
paletteIndex = screens[0][y*SCREENWIDTH + x];
|
||||
paletteIndex = d_screens[0][y*SCREENWIDTH + x];
|
||||
rb->lcd_framebuffer[y * LCD_WIDTH + x] = palette[paletteIndex];
|
||||
}
|
||||
}
|
||||
|
|
@ -371,7 +375,7 @@ void I_FinishUpdate (void)
|
|||
//
|
||||
void I_ReadScreen (byte* scr)
|
||||
{
|
||||
memcpy (scr, screens[0], SCREENWIDTH*SCREENHEIGHT);
|
||||
memcpy (scr, d_screens[0], SCREENWIDTH*SCREENHEIGHT);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
@ -399,9 +403,9 @@ void I_InitGraphics(void)
|
|||
|
||||
#if defined(CPU_COLDFIRE) && !defined(SIMULATOR)
|
||||
coldfire_set_macsr(EMAC_FRACTIONAL | EMAC_SATURATE);
|
||||
screens[0] = fastscreen;
|
||||
d_screens[0] = fastscreen;
|
||||
#else
|
||||
// Don't know if this will fit in other IRAMs
|
||||
screens[0] = malloc (SCREENWIDTH * SCREENHEIGHT * sizeof(unsigned char));
|
||||
d_screens[0] = malloc (SCREENWIDTH * SCREENHEIGHT * sizeof(unsigned char));
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -573,7 +573,7 @@ void R_InitBuffer(int width, int height)
|
|||
|
||||
viewwindowy = width==SCREENWIDTH ? 0 : (SCREENHEIGHT-(ST_SCALED_HEIGHT-1)-height)>>1;
|
||||
|
||||
topleft = screens[0] + viewwindowy*SCREENWIDTH + viewwindowx;
|
||||
topleft = d_screens[0] + viewwindowy*SCREENWIDTH + viewwindowx;
|
||||
|
||||
// Preclaculate all row offsets.
|
||||
// CPhipps - merge viewwindowx into here
|
||||
|
|
@ -627,7 +627,7 @@ void R_FillBackScreen (void)
|
|||
|
||||
void R_VideoErase(unsigned ofs, int count)
|
||||
{
|
||||
memcpy(screens[0]+ofs, screens[1]+ofs, count); // LFB copy.
|
||||
memcpy(d_screens[0]+ofs, d_screens[1]+ofs, count); // LFB copy.
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
|||
|
|
@ -1148,6 +1148,6 @@ void ST_Init(void)
|
|||
veryfirsttime = 0;
|
||||
ST_loadData();
|
||||
// proff 08/18/98: Changed for high-res
|
||||
screens[4] = Z_Malloc(SCREENWIDTH*(ST_SCALED_HEIGHT+1), PU_STATIC, 0);
|
||||
// screens[4] = Z_Malloc(ST_WIDTH*ST_HEIGHT, PU_STATIC, 0);
|
||||
d_screens[4] = Z_Malloc(SCREENWIDTH*(ST_SCALED_HEIGHT+1), PU_STATIC, 0);
|
||||
// d_screens[4] = Z_Malloc(ST_WIDTH*ST_HEIGHT, PU_STATIC, 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
#include "m_swap.h"
|
||||
#include "rockmacros.h"
|
||||
// Each screen is [SCREENWIDTH*SCREENHEIGHT];
|
||||
byte *screens[6] IBSS_ATTR;
|
||||
byte *d_screens[6] IBSS_ATTR;
|
||||
int dirtybox[4];
|
||||
|
||||
/* jff 4/24/98 initialize this at runtime */
|
||||
|
|
@ -239,8 +239,8 @@ void V_CopyRect(int srcx, int srcy, int srcscrn, int width,
|
|||
|
||||
V_MarkRect (destx, desty, width, height);
|
||||
|
||||
src = screens[srcscrn]+SCREENWIDTH*srcy+srcx;
|
||||
dest = screens[destscrn]+SCREENWIDTH*desty+destx;
|
||||
src = d_screens[srcscrn]+SCREENWIDTH*srcy+srcx;
|
||||
dest = d_screens[destscrn]+SCREENWIDTH*desty+destx;
|
||||
|
||||
for ( ; height>0 ; height--)
|
||||
{
|
||||
|
|
@ -294,7 +294,7 @@ void V_DrawBlock(int x, int y, int scrn, int width, int height,
|
|||
if (!scrn)
|
||||
V_MarkRect (x, y, width, height);
|
||||
|
||||
dest = screens[scrn] + y*SCREENWIDTH+x;
|
||||
dest = d_screens[scrn] + y*SCREENWIDTH+x;
|
||||
// x & y no longer needed
|
||||
|
||||
while (height--) {
|
||||
|
|
@ -308,7 +308,7 @@ void V_DrawBlock(int x, int y, int scrn, int width, int height,
|
|||
} else {
|
||||
V_MarkRect (x, y, width, height);
|
||||
|
||||
dest = screens[scrn] + y*SCREENWIDTH+x;
|
||||
dest = d_screens[scrn] + y*SCREENWIDTH+x;
|
||||
|
||||
while (height--) {
|
||||
memcpy (dest, src, width);
|
||||
|
|
@ -369,7 +369,7 @@ void V_GetBlock(int x, int y, int scrn, int width, int height, byte *dest)
|
|||
I_Error ("V_GetBlock: Bad arguments");
|
||||
#endif
|
||||
|
||||
src = screens[scrn] + y*SCREENWIDTH+x;
|
||||
src = d_screens[scrn] + y*SCREENWIDTH+x;
|
||||
|
||||
while (height--)
|
||||
{
|
||||
|
|
@ -394,13 +394,13 @@ void V_Init (void)
|
|||
#define PREALLOCED_SCREENS 2
|
||||
|
||||
// CPhipps - no point in "stick these in low dos memory on PCs" anymore
|
||||
// Allocate the screens individually, so I_InitGraphics can release screens[0]
|
||||
// Allocate the screens individually, so I_InitGraphics can release d_screens[0]
|
||||
// if e.g. it wants a MitSHM buffer instead
|
||||
|
||||
for (i=0 ; i<PREALLOCED_SCREENS ; i++)
|
||||
screens[i] = calloc(SCREENWIDTH*SCREENHEIGHT, 1);
|
||||
d_screens[i] = calloc(SCREENWIDTH*SCREENHEIGHT, 1);
|
||||
for (; i<4; i++) // Clear the rest (paranoia)
|
||||
screens[i] = NULL;
|
||||
d_screens[i] = NULL;
|
||||
}
|
||||
|
||||
//
|
||||
|
|
@ -448,7 +448,7 @@ void V_DrawMemPatch(int x, int y, int scrn, const patch_t *patch,
|
|||
if (!(flags & VPT_STRETCH)) {
|
||||
unsigned int col;
|
||||
const column_t *column;
|
||||
byte *desttop = screens[scrn]+y*SCREENWIDTH+x;
|
||||
byte *desttop = d_screens[scrn]+y*SCREENWIDTH+x;
|
||||
unsigned int w = SHORT(patch->width);
|
||||
|
||||
if (!scrn)
|
||||
|
|
@ -544,7 +544,7 @@ void V_DrawMemPatch(int x, int y, int scrn, const patch_t *patch,
|
|||
V_MarkRect ( stretchx, stretchy, (SHORT( patch->width ) * DX ) >> 16,
|
||||
(SHORT( patch->height) * DY ) >> 16 );
|
||||
|
||||
desttop = screens[scrn] + stretchy * SCREENWIDTH + stretchx;
|
||||
desttop = d_screens[scrn] + stretchy * SCREENWIDTH + stretchx;
|
||||
|
||||
for ( col = 0; col <= w; x++, col+=DXI, desttop++ ) {
|
||||
const column_t *column;
|
||||
|
|
@ -640,11 +640,11 @@ byte *V_PatchToBlock(const char* name, int cm,
|
|||
enum patch_translation_e flags,
|
||||
unsigned short* width, unsigned short* height)
|
||||
{
|
||||
byte *oldscr = screens[1];
|
||||
byte *oldscr = d_screens[1];
|
||||
byte *block;
|
||||
const patch_t *patch;
|
||||
|
||||
screens[1] = calloc(SCREENWIDTH*SCREENHEIGHT, 1);
|
||||
d_screens[1] = calloc(SCREENWIDTH*SCREENHEIGHT, 1);
|
||||
|
||||
patch = W_CacheLumpName(name);
|
||||
V_DrawMemPatch(SHORT(patch->leftoffset), SHORT(patch->topoffset),
|
||||
|
|
@ -662,8 +662,8 @@ byte *V_PatchToBlock(const char* name, int cm,
|
|||
V_GetBlock(0, 0, 1, *width, *height,
|
||||
block = malloc((long)(*width) * (*height)));
|
||||
|
||||
free(screens[1]);
|
||||
screens[1] = oldscr;
|
||||
free(d_screens[1]);
|
||||
d_screens[1] = oldscr;
|
||||
return block;
|
||||
}
|
||||
#endif /* GL_DOOM */
|
||||
|
|
@ -691,7 +691,7 @@ void V_SetPalette(int pal)
|
|||
#ifndef GL_DOOM
|
||||
void V_FillRect(int scrn, int x, int y, int width, int height, byte colour)
|
||||
{
|
||||
byte* dest = screens[scrn] + x + y*SCREENWIDTH;
|
||||
byte* dest = d_screens[scrn] + x + y*SCREENWIDTH;
|
||||
while (height--) {
|
||||
memset(dest, colour, width);
|
||||
dest += SCREENWIDTH;
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ typedef enum
|
|||
|
||||
#define CR_DEFAULT CR_RED /* default value for out of range colors */
|
||||
|
||||
extern byte *screens[6];
|
||||
extern byte *d_screens[6];
|
||||
extern int dirtybox[4];
|
||||
extern const byte gammatable[5][256];
|
||||
extern int usegamma;
|
||||
|
|
@ -173,11 +173,11 @@ void V_SetPalette(int pal);
|
|||
// CPhipps - function to plot a pixel
|
||||
|
||||
#ifndef GL_DOOM
|
||||
#define V_PlotPixel(s,x,y,c) screens[s][x+SCREENWIDTH*y]=c
|
||||
#define V_PlotPixel(s,x,y,c) d_screens[s][x+SCREENWIDTH*y]=c
|
||||
#endif
|
||||
|
||||
#define V_AllocScreen(scrn) screens[scrn] = malloc(SCREENWIDTH*SCREENHEIGHT)
|
||||
#define V_FreeScreen(scrn) free(screens[scrn]); screens[scrn] = NULL
|
||||
#define V_AllocScreen(scrn) d_screens[scrn] = malloc(SCREENWIDTH*SCREENHEIGHT)
|
||||
#define V_FreeScreen(scrn) free(d_screens[scrn]); d_screens[scrn] = NULL
|
||||
|
||||
#ifdef GL_DOOM
|
||||
#include "gl_struct.h"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue