Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix all error sefaults #27

Merged
merged 2 commits into from Aug 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 4 additions & 90 deletions daphne/daphne-1.0-src/io/error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,108 +45,22 @@ const char CRLF[3] = { 13, 10, 0 }; // carriage return / linefeed combo, for the
// notifies the user of an error that has occurred
void printerror(const char *s)
{
/* SDL_Rect region = { 0, 180, get_video_width(), (Uint16)(get_video_height() >> 1) };

addlog(s);
addlog(CRLF);

// if video has been initialized
// FIXME: if bmp hasn't been loaded this might blow up
if (true)
{
SDL_Surface *srfScreen = get_screen_blitter();
unsigned int uXOffset = 0;

vid_blank(); // needed for opengl

// only draw this graphic if our width is at least 640 (it can be smaller on handheld)
if (srfScreen->w >= 640)
{
uXOffset = 80; // shift to the right to compensate for graphic
draw_othergfx(B_DAPHNE_SAVEME, 0, 180);
}

// make sure text is centered
SDLDrawText(s, srfScreen, FONT_SMALL, ((srfScreen->w >> 1) + uXOffset -((strlen(s) >> 1)*6)), (srfScreen->h >> 1)-13);
SDLDrawText(instr, srfScreen, FONT_SMALL, ((srfScreen->w >> 1) + uXOffset -((strlen(instr) >> 1)*6)), (srfScreen->h >> 1));

vid_blit(srfScreen, 0, 0);
vid_flip();

// play a 'save me' sound if we've got sound
if (get_sound_initialized())
{
sound_play_saveme();
}

//con_getkey(); // wait for keypress

vid_blank();
vid_flip();

// MATT : we can't call video_repaint because the video might not have been initialized
// yet. We can either comment this out, or add safety checks in video_repaint (which
// is kind of a hassle right now since we have a bunch of redundant copies everywhere)

} // end if video has been initialized

// if video has not been initialized, print an error any way that we can
else
{
#ifdef WIN32
MessageBox(NULL, s, "DAPHNE encountered an error", MB_OK | MB_ICONERROR);
#else
printf("%s\n",s);
#endif
} */
printf("%s\n",s);
}

// notifies user that the game does not work correctly and gives a reason
// this should be called after video has successfully been initialized
void printnowookin(const char *s)
{
/* if (true)
{
SDL_Surface *srfScreen = get_screen_blitter();

vid_blank();
// don't draw 'no wookin' graphic if display is too small (can happen on handheld)
if (srfScreen->w >= 640) draw_othergfx(B_GAMENOWOOK, 0, 180);
SDLDrawText(s, srfScreen, FONT_SMALL, ((srfScreen->w >> 1) -((strlen(s) >> 1)*6)), (srfScreen->h >> 1));
vid_blit(srfScreen, 0, 0);
vid_flip();
//con_getkey(); // wait for keypress

// repaint the disrupted overlay (ie Dragon's Lair Scoreboard when using a real LDP)
display_repaint();
}
*/
printf("%s\n",s);
addlog(s);
addlog(CRLF);
}

// prints a notice to the screen
void printnotice(const char *s)
{
printf("%s\n",s);

/* no screen to draw on
if (true)
{
char ch = 0;
SDL_Surface *srfScreen = get_screen_blitter();

SDL_FillRect(srfScreen, NULL, 0); // draw black background first
SDLDrawText(s, srfScreen, FONT_SMALL, ((srfScreen->w >> 1)-((strlen(s) >> 1)*6)), (srfScreen->h >> 1));

vid_blank(); // needed by opengl
vid_blit(srfScreen, 0, 0);
vid_flip();
addlog(s);
addlog(CRLF);

#if 0
if (con_getkey() == SDL_SCANCODE_ESCAPE)
set_quitflag();
#endif
}
*/
}
29 changes: 7 additions & 22 deletions daphne/daphne-1.0-src/ldp-out/ldp-vldp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,7 @@ VIDEO_BUFFER g_hw_overlay[VIDEO_BUFFER_AMOUNT] = { { VB_STATE_USEABLE, NULL }, {

#define LOGVBSYS(STRIN)

// ********************************************************************************************************************************
// ********************************************************************************************************************************

bool initialize_vb(Uint32 format, Uint32 target_format, int w, int h)
{
LOGVBSYS("INITIALIZATION, top.");
Expand All @@ -144,8 +143,6 @@ bool initialize_vb(Uint32 format, Uint32 target_format, int w, int h)
return true;
}

// ********************************************************************************************************************************
// ********************************************************************************************************************************
void teardown_vb()
{
LOGVBSYS("TEARDOWN, top.");
Expand All @@ -166,8 +163,7 @@ void teardown_vb()
LOGVBSYS("TEARDOWN, bottom.");
}

// ********************************************************************************************************************************
// ********************************************************************************************************************************

SDL_SW_YUVTexture * get_vb_next_usable(int * vb_ndx)
{
LOGVBSYS("getUSABLE, top, before RECLAIM.");
Expand Down Expand Up @@ -233,8 +229,7 @@ SDL_SW_YUVTexture * get_vb_next_usable(int * vb_ndx)
return(g_hw_overlay[vb_next].video_buffer);
}

// ********************************************************************************************************************************
// ********************************************************************************************************************************

SDL_SW_YUVTexture * get_vb_filling(int * vb_ndx)
{
LOGVBSYS("getFILLING, top.");
Expand All @@ -260,8 +255,7 @@ SDL_SW_YUVTexture * get_vb_filling(int * vb_ndx)
return(g_hw_overlay[g_vb_filling_queue].video_buffer);
}

// ********************************************************************************************************************************
// ********************************************************************************************************************************

void set_vb_filling_done(int vb_ndx)
{
LOGVBSYS("setFILLING_DONE, top.");
Expand Down Expand Up @@ -314,8 +308,7 @@ void set_vb_filling_done(int vb_ndx)
LOGVBSYS("setFILLING_DONE, bottom.");
}

// ********************************************************************************************************************************
// ********************************************************************************************************************************

SDL_SW_YUVTexture * get_vb_waiting(int * vb_ndx)
{
LOGVBSYS("getWAITING, top.");
Expand Down Expand Up @@ -354,8 +347,6 @@ SDL_SW_YUVTexture * get_vb_waiting(int * vb_ndx)
return(vb_rendering);
}

// ********************************************************************************************************************************
// ********************************************************************************************************************************
void set_vb_rendering_done(int vb_ndx)
{
LOGVBSYS("setRENDERING_DONE, top.");
Expand Down Expand Up @@ -1888,8 +1879,7 @@ bool ldp_vldp::parse_framefile(const char *pszInBuf, const char *pszFramefileFul


// RJS HERE - prepare frame
//******************************************************************************
//******************************************************************************

int prepare_frame_callback_with_overlay(struct yuv_buf *src)
{
int result = VLDP_FALSE;
Expand Down Expand Up @@ -2098,8 +2088,7 @@ int prepare_frame_callback_with_overlay(struct yuv_buf *src)
return result;
}

//******************************************************************************
//******************************************************************************

int prepare_frame_callback_without_overlay(struct yuv_buf *buf)
{
int result = VLDP_FALSE;
Expand Down Expand Up @@ -2128,8 +2117,6 @@ int prepare_frame_callback_without_overlay(struct yuv_buf *buf)
return result;
}

//*********************************************************************************************************************************
//*********************************************************************************************************************************
// displays the frame as fast as possible
// RJS NOTE - *** video frames ***
extern "C" {
Expand Down Expand Up @@ -2176,8 +2163,6 @@ void display_frame_callback(struct yuv_buf *buf)
set_vb_filling_done(vb_ndx);
}

//*********************************************************************************************************************************
//*********************************************************************************************************************************
// This function converts the YV12-formatted 'src' to a YUY2-formatted overlay (which Xbox-Daphne may be using)
// copies the contents of src into dst
// assumes destination overlay is locked and *IMPORTANT* assumes src and dst are the same resolution
Expand Down