DC port from DoctorN?

Started by MisterN, October 03, 2011, 12:08:57 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MisterN

It was getting ready to compile but I got these errors:

.objs\main.o||In function `main':|
\DCennu\DCennu\main.c|171|undefined reference to `_appexefullpath'|
E:\Nick Lopez\DCennu\DCennu\main.c|171|undefined reference to `_appexename'|
E:\Nick Lopez\DCennu\DCennu\main.c|171|undefined reference to `_getfullpath'|
E:\Nick Lopez\DCennu\DCennu\main.c|171|undefined reference to `_whereis'|
E:\Nick Lopez\DCennu\DCennu\main.c|171|undefined reference to `_appexepath'|
E:\Nick Lopez\DCennu\DCennu\main.c|171|undefined reference to `_file_addp'|
E:\Nick Lopez\DCennu\DCennu\main.c|171|undefined reference to `_file_open'|
E:\Nick Lopez\DCennu\DCennu\main.c|171|undefined reference to `_file_seek'|
E:\Nick Lopez\DCennu\DCennu\main.c|171|undefined reference to `_file_read'|
E:\Nick Lopez\DCennu\DCennu\main.c|171|undefined reference to `_debug'|
E:\Nick Lopez\DCennu\DCennu\main.c|333|undefined reference to `_file_addp'|
E:\Nick Lopez\DCennu\DCennu\main.c|333|undefined reference to `_appexename'|
E:\Nick Lopez\DCennu\DCennu\main.c|333|undefined reference to `_string_init'|
E:\Nick Lopez\DCennu\DCennu\main.c|333|undefined reference to `_init_c_type'|
E:\Nick Lopez\DCennu\DCennu\main.c|333|undefined reference to `_appname'|
E:\Nick Lopez\DCennu\DCennu\main.c|333|undefined reference to `_dcb_load'|
E:\Nick Lopez\DCennu\DCennu\main.c|333|undefined reference to `_dcb_load_from'|
E:\Nick Lopez\DCennu\DCennu\main.c|333|undefined reference to `_dcb'|
E:\Nick Lopez\DCennu\DCennu\main.c|333|undefined reference to `_debug'|
E:\Nick Lopez\DCennu\DCennu\main.c|333|undefined reference to `_sysproc_init'|
E:\Nick Lopez\DCennu\DCennu\main.c|333|undefined reference to `_bgdrtm_entry'|
E:\Nick Lopez\DCennu\DCennu\main.c|333|undefined reference to `_mainproc'|
E:\Nick Lopez\DCennu\DCennu\main.c|333|undefined reference to `_instance_new'|
E:\Nick Lopez\DCennu\DCennu\main.c|333|undefined reference to `_instance_go_all'|
E:\Nick Lopez\DCennu\DCennu\main.c|333|undefined reference to `_bgdrtm_exit'|
E:\Nick Lopez\DCennu\DCennu\main.c|333|undefined reference to `_appexepath'|
E:\Nick Lopez\DCennu\DCennu\main.c|333|undefined reference to `_appexefullpath'|
||=== Build finished: 27 errors, 0 warnings ===|


and here is the code, slightly edited from your bgdi source. you say that bgdrtm needs to be compiled, but i saw nothing in there that should be for bgdi compiles it right?

*  Copyright © 2006-2011 SplinterGU (Fenix/Bennugd)
*  Copyright © 2002-2006 Fenix Team (Fenix)
*  Copyright © 1999-2002 José Luis Cebrián Pagüe (Fenix)
*
*  This file is part of Bennu - Game Development
*
*  This software is provided 'as-is', without any express or implied
*  warranty. In no event will the authors be held liable for any damages
*  arising from the use of this software.
*
*  Permission is granted to anyone to use this software for any purpose,
*  including commercial applications, and to alter it and redistribute it
*  freely, subject to the following restrictions:
*
*     1. The origin of this software must not be misrepresented; you must not
*     claim that you wrote the original software. If you use this software
*     in a product, an acknowledgment in the product documentation would be
*     appreciated but is not required.
*
*     2. Altered source versions must be plainly marked as such, and must not be
*     misrepresented as being the original software.
*
*     3. This notice may not be removed or altered from any source
*     distribution.
*
*/
/*
* INCLUDES
*/
#ifdef _WIN32
#define  _WIN32_WINNT 0x0500
#include <windows.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include "bgdi.h"
#include "bgdrtm.h"
#include "xstrings.h"
#include "dirs.h"
/* ---------------------------------------------------------------------- */
static char * dcb_exts[] = { ".dcb", ".dat", ".bin", NULL };
static int standalone  = 0;  /* 1 only if this is an standalone interpreter   */
static int embedded    = 0;  /* 1 only if this is a stub with an embedded DCB */
/* ---------------------------------------------------------------------- */
/*
*  FUNCTION : main
*
*  Main function
*
*  PARAMS:
*      INT n: ERROR LEVEL to return to OS
*
*  RETURN VALUE:
*      No value
*
*/
int main( int argc, char *argv[] )
{
    char * filename = NULL, dcbname[ __MAX_PATH ], *ptr, *arg0;
    int i, j, ret = -1;
    file * fp = NULL;
    INSTANCE * mainproc_running;
    dcb_signature dcb_signature;
    /* get my executable name */
#ifdef _WIN32
    if ( strlen( argv[0] ) < 4 || strncmpi( &argv[0][strlen( argv[0] ) - 4], ".exe", 4 ) )
    {
        arg0 = malloc( strlen( argv[0] ) + 5 );
        sprintf( arg0, "%s.exe", argv[0] );
    }
    else
    {
#endif
        arg0 = strdup( argv[0] );
#ifdef _WIN32
    }
#endif
    ptr = arg0 + strlen( arg0 );
    while ( ptr > arg0 && ptr[-1] != '\\' && ptr[-1] != '/' ) ptr-- ;
    appexename = strdup( ptr );
    /* get executable full pathname  */
    fp = NULL;
    appexefullpath = getfullpath( arg0 );
    if ( ( !strchr( arg0, '\\' ) && !strchr( arg0, '/' ) ) )
    {
        struct stat st;
        if ( stat( appexefullpath, &st ) || !S_ISREG( st.st_mode ) )
        {
            char *p = whereis( appexename );
            if ( p )
            {
                char * tmp = calloc( 1, strlen( p ) + strlen( appexename ) + 2 );
                free( appexefullpath );
                sprintf( tmp, "%s/%s", p, appexename );
                appexefullpath = getfullpath( tmp );
                free( tmp );
            }
        }
    }
    /* get pathname of executable */
    ptr = strstr( appexefullpath, appexename );
    appexepath = calloc( 1, ptr - appexefullpath + 1 );
    strncpy( appexepath, appexefullpath, ptr - appexefullpath );
    standalone = ( strncmpi( appexename, "bgdi", 4 ) == 0 ) ;
    /* add binary path */
    file_addp( appexepath );
    if ( !standalone )
    {
        /* Hand-made interpreter: search for DCB at EOF */
        fp = file_open( appexefullpath, "rb0" );
        if ( fp )
        {
            file_seek( fp, -( int )sizeof( dcb_signature ), SEEK_END );
            file_read( fp, &dcb_signature, sizeof( dcb_signature ) );
            if ( strcmp( dcb_signature.magic, DCB_STUB_MAGIC ) == 0 )
            {
                ARRANGE_DWORD( &dcb_signature.dcb_offset );
                embedded = 1;
            }
        }
        filename = appexefullpath;
    }
    if ( standalone )
    {
        /* Calling BGDI.EXE so we must get all command line params */
        for ( i = 1 ; i < argc ; i++ )
        {
            if ( argv[i][0] == '-' )
            {
                j = 1 ;
                while ( argv[i][j] )
                {
                    if ( argv[i][j] == 'd' ) debug = 1 ;
                    if ( argv[i][j] == 'i' )
                    {
                        if ( argv[i][j+1] == 0 )
                        {
                            if ( i == argc - 1 )
                            {
                                fprintf( stderr, "You must provide a directory" ) ;
                                exit( 0 );
                            }
                            file_addp( argv[i+1] );
                            i++ ;
                            break ;
                        }
                        file_addp( &argv[i][j + 1] ) ;
                        break ;
                    }
                    j++ ;
                }
            }
            else
            {
                if ( !filename )
                {
                    filename = argv[i] ;
                    if ( i < argc - 1 ) memmove( &argv[i], &argv[i+1], sizeof( char* ) * ( argc - i - 1 ) ) ;
                    argc-- ;
                    i-- ;
                }
            }
        }
        if ( !filename )
        {
            printf( "BGDI_VERSION \n"
                    "Bennu Game Development Interpreter\n"
                    "\n"
                    "Copyright (c) 2006-2011 SplinterGU (Fenix/BennuGD)\n"
                    "Copyright (c) 2002-2006 Fenix Team (Fenix)\n"
                    "Copyright (c) 1999-2002 José Luis Cebrián Pagüe (Fenix)\n"
                    "\n"
                    "Usage: %s [options] <data code block file>[.dcb]\n"
                    "\n"
                    "   -d       Activate DEBUG mode\n"
                    "   -i dir   Adds the directory to the PATH\n"
                    "\n"
                    "This software is provided 'as-is', without any express or implied\n"
                    "warranty. In no event will the authors be held liable for any damages\n"
                    "arising from the use of this software.\n"
                    "\n"
                    "Permission is granted to anyone to use this software for any purpose,\n"
                    "including commercial applications, and to alter it and redistribute it\n"
                    "freely, subject to the following restrictions:\n"
                    "\n"
                    "   1. The origin of this software must not be misrepresented; you must not\n"
                    "   claim that you wrote the original software. If you use this software\n"
                    "   in a product, an acknowledgment in the product documentation would be\n"
                    "   appreciated but is not required.\n"
                    "\n"
                    "   2. Altered source versions must be plainly marked as such, and must not be\n"
                    "   misrepresented as being the original software.\n"
                    "\n"
                    "   3. This notice may not be removed or altered from any source\n"
                    "   distribution.\n"
                    , appexename ) ;
            return -1 ;
        }
    }
    /* Initialization (modules needed before dcb_load) */
    string_init() ;
    init_c_type() ;
    /* Init application title for windowed modes */
    strcpy( dcbname, filename ) ;
    ptr = filename + strlen( filename );
    while ( ptr > filename && ptr[-1] != '\\' && ptr[-1] != '/' ) ptr-- ;
    appname = strdup( ptr ) ;
    if ( strlen( appname ) > 3 )
    {
        char ** dcbext = dcb_exts, *ext = &appname[ strlen( appname ) - 4 ];
#ifdef _WIN32
        if ( !strncmpi( ext, ".exe", 4 ) )
        {
            *ext = '\0';
        }
        else
#endif
        while ( dcbext && *dcbext )
        {
            if ( !strncmpi( ext, *dcbext, 4 ) )
            {
                *ext = '\0';
                break;
            }
            dcbext++;
        }
    }
/*
printf( "appname        %s\n", appname);
printf( "appexename     %s\n", appexename);
printf( "appexepath     %s\n", appexepath);
printf( "appexefullpath %s\n", appexefullpath);
printf( "dcbname        %s\n", dcbname);
fflush(stdout);
*/
    if ( !embedded )
    {
        /* First try to load directly (we expect myfile.dcb) */
        if ( !dcb_load( dcbname ) )
        {
            char ** dcbext = dcb_exts;
            int dcbloaded = 0;
            while ( dcbext && *dcbext )
            {
                strcpy( dcbname, filename ) ;
                strcat( dcbname, *dcbext ) ;
                if (( dcbloaded = dcb_load( dcbname ) ) ) break;
                dcbext++;
            }
            if ( !dcbloaded )
            {
                printf( "%s: doesn't exist or isn't version %d DCB compatible\n", filename, DCB_VERSION >> 8 ) ;
                return -1 ;
            }
        }
    }
    else
    {
        dcb_load_from( fp, dcbname, dcb_signature.dcb_offset );
    }
    /* If the dcb is not in debug mode */
    if ( dcb.data.NSourceFiles == 0 ) debug = 0;
    /* Initialization (modules needed after dcb_load) */
    sysproc_init() ;
#ifdef _WIN32
    HWND hWnd = /*GetForegroundWindow()*/ GetConsoleWindow();
    DWORD dwProcessId;
    GetWindowThreadProcessId( hWnd, &dwProcessId );
    if ( dwProcessId == GetCurrentProcessId() ) ShowWindow( hWnd, SW_HIDE );
#endif
    argv[0] = filename;
    bgdrtm_entry( argc, argv );
    if ( mainproc )
    {
        mainproc_running = instance_new( mainproc, NULL ) ;
        ret = instance_go_all() ;
    }
    bgdrtm_exit( ret );
    free( appexename        );
    free( appexepath        );
    free( appexefullpath    );
    free( appname           );
    return ret;
}
werg

josebita

#46
Quote from: DoctorN on October 07, 2011, 12:04:40 AM
Quote from: josebita on October 06, 2011, 03:26:44 PM
we better advance step by step.

oh no no no no no i dont learn that way. i got rid of that hello world, that thing was gay. yes i am just downright compiling bgdi and i have 1 error and 1 warning. codeblocks is the IDE set up to compile it in cygwin and kos
The purpose of the "Hello, World!" example is not to determine if you like getting laid with men or women but to determine wether your compilation toolchain is working correctly. Also, you get a very simple working binary that you know has no place for failure that you can convert into the machine's native binary format. That way if things aren't working you can directly assume that it's nt the toolchain that is working wrong.

Quote from: DoctorN on October 07, 2011, 04:51:34 AM
It was getting ready to compile but I got these errors:

.objs\main.o||In function `main':|
\DCennu\DCennu\main.c|171|undefined reference to `_appexefullpath'|
E:\Nick Lopez\DCennu\DCennu\main.c|171|undefined reference to `_appexename'|
E:\Nick Lopez\DCennu\DCennu\main.c|171|undefined reference to `_getfullpath'|
E:\Nick Lopez\DCennu\DCennu\main.c|171|undefined reference to `_whereis'|
E:\Nick Lopez\DCennu\DCennu\main.c|171|undefined reference to `_appexepath'|
E:\Nick Lopez\DCennu\DCennu\main.c|171|undefined reference to `_file_addp'|
E:\Nick Lopez\DCennu\DCennu\main.c|171|undefined reference to `_file_open'|
E:\Nick Lopez\DCennu\DCennu\main.c|171|undefined reference to `_file_seek'|
E:\Nick Lopez\DCennu\DCennu\main.c|171|undefined reference to `_file_read'|
E:\Nick Lopez\DCennu\DCennu\main.c|171|undefined reference to `_debug'|
E:\Nick Lopez\DCennu\DCennu\main.c|333|undefined reference to `_file_addp'|
E:\Nick Lopez\DCennu\DCennu\main.c|333|undefined reference to `_appexename'|
E:\Nick Lopez\DCennu\DCennu\main.c|333|undefined reference to `_string_init'|
E:\Nick Lopez\DCennu\DCennu\main.c|333|undefined reference to `_init_c_type'|
E:\Nick Lopez\DCennu\DCennu\main.c|333|undefined reference to `_appname'|
E:\Nick Lopez\DCennu\DCennu\main.c|333|undefined reference to `_dcb_load'|
E:\Nick Lopez\DCennu\DCennu\main.c|333|undefined reference to `_dcb_load_from'|
E:\Nick Lopez\DCennu\DCennu\main.c|333|undefined reference to `_dcb'|
E:\Nick Lopez\DCennu\DCennu\main.c|333|undefined reference to `_debug'|
E:\Nick Lopez\DCennu\DCennu\main.c|333|undefined reference to `_sysproc_init'|
E:\Nick Lopez\DCennu\DCennu\main.c|333|undefined reference to `_bgdrtm_entry'|
E:\Nick Lopez\DCennu\DCennu\main.c|333|undefined reference to `_mainproc'|
E:\Nick Lopez\DCennu\DCennu\main.c|333|undefined reference to `_instance_new'|
E:\Nick Lopez\DCennu\DCennu\main.c|333|undefined reference to `_instance_go_all'|
E:\Nick Lopez\DCennu\DCennu\main.c|333|undefined reference to `_bgdrtm_exit'|
E:\Nick Lopez\DCennu\DCennu\main.c|333|undefined reference to `_appexepath'|
E:\Nick Lopez\DCennu\DCennu\main.c|333|undefined reference to `_appexefullpath'|
||=== Build finished: 27 errors, 0 warnings ===|


and here is the code, slightly edited from your bgdi source. you say that bgdrtm needs to be compiled, but i saw nothing in there that should be for bgdi compiles it right?
All those errors are from a missing bgdrtm. If you have a look at the bgdrtm source you'll see functions named like that: bgdrtm_entry, dcb_load, dcb_load_from, bgdrtm_exit and so on.

Again, I advise you to try to compile a very simple test program to check if you can create valid DC binaries but anyway, if you want to go the hard way and not check things are working fine before assuming they are (VERY bad idea!) I'll tell you that the next step is to compile bgdrtm alongside bgdi.
To do so, you have to compile all the source files that comprise bgdrtm into a static library and then link bgdi against that static library or you can compile all the .c files from both bgdrtm and bgdi together, using the BGDRTM preprocessor macro. The first choice is much cleaner. Those files are the ones defined here:
http://code.google.com/p/bennugd-monolithic/source/browse/trunk/core/bgdrtm/Makefile#71
(For now just ignore the ones that are in the modules/ directory, also you probably want to ignore the source file in the 3rdparty directory but that depends on which libc your DC SDK is using).
And the preprocessor macros you have to define are as (choose only those that apply) defined here:
http://code.google.com/p/bennugd-monolithic/source/browse/trunk/core/bgdrtm/Makefile#43

Please report on advances.

FreeYourMind

I don't wanna be rude, but really I think than DoctorN can't compile a Bennu for DC because he need to practice and learn much more about programming languajes.

MisterN

I do not learn that way, im sorry. Just help me compile it. You people said you would but it seems as though you are all backing away.
werg

josebita

Quote from: DoctorN on October 07, 2011, 12:42:15 PM
I do not learn that way, im sorry. Just help me compile it. You people said you would but it seems as though you are all backing away.
You're free to learn the hard way if you want to.
I already told you what you have to do next: compile bgdrtm and bgdi into the same binary in your IDE. There's no single .c file that will do that for you: you have to compile many of them inside one single binary.

SplinterGU

#50
Quote from: FreeYourMind on October 07, 2011, 09:19:53 AM
I don't wanna be rude, but really I think than DoctorN can't compile a Bennu for DC because he need to practice and learn much more about programming languajes.

DoctorN, if FreeYourMind said it... maybe you must listen him... FreeYourMind need learn lot of about this topic, but even need it, he know mucho more that you.

Quote from: DoctorN on October 07, 2011, 12:42:15 PM
I do not learn that way, im sorry. Just help me compile it. You people said you would but it seems as though you are all backing away.

you think that this is only, put sources in your cross-compiler and do make? if you think, you really do this because you think that I'm a bastard... I must say that you are really wrong... really wrong... this jobs isn't a easy task, even for an expert programmer...
I don't do it no for I'm a stupid bastard, but this will require a time that I haven't at this moment, and the cost (job) don't justify the prize for me...
Download Lastest BennuGD Release: http://www.bennugd.org/node/2

josebita

Just to illustrate Splinter's point, it took me MONTHs to get a bgdi+bgdrtm (without ANY module) running in the Wii and around a year to take a port to a usable state.
It's just not reasonable for you to expect to be able to complete the DC port in a few days, specially if you have no prior experience in cross-compiling or programming for embedded systems.
You say that that's the way you learn but you're making it really hard for yourself.
Anyway, it's up to you.

l1nk3rn3l

#52

splinter have reason.. this project its free  .. time not available..




but...



our team, will compile this weekend bennu with "windows ce - official sega sdk"
its illegal but more practice.. wil be.. how a unofficial port.. 

dont worry be happy


:o

SplinterGU

Quote from: l1nk3rn3l on October 07, 2011, 05:08:52 PM
our team, will compile this weekend bennu with "windows ce - official sega sdk"
its illegal but more practice.. how a unofficial port.. 

dont worry be happy


:o

great!

good luck and enjoy it!

:)
Download Lastest BennuGD Release: http://www.bennugd.org/node/2

MisterN

Quote from: l1nk3rn3l on October 07, 2011, 05:08:52 PM

our team, will compile this weekend bennu with "windows ce - official sega sdk"
its illegal but more practice.. wil be.. how a unofficial port.. 


its not illegal anymore lol. I didnt mean to snap at you Splinter if thats how you interpreted it. I was asking a russian programmer by the name of SWAT (who created an operating system to replace the dreamcasts bios). He ported fenix over and here is his modified source code of fenix http://www.dc-swat.ru/download/dc/fenix/Fenix_v0.93_updated_source_for_DC.tar.bz2

werg

MisterN

#55
If you use the wince kit, it cannot be tested on an emulator.

Please look at SWAT's code, everything dreamcast specific is there.

For example, the controls used should appear in there, L and R arent there but thats probably because they arent set in lol. SDL_DC_R should be the tab key and SDL_DC_L should be the backspace key. You mat want to rename some of the controls based on what chuy had here: http://chui.dcemu.co.uk/sdl.html so one does not get confused when making a 4 player game.

The game does not need to be compiled on the dreamcast, simply because it shares things with windows, you could use the latest fenix pack for the fenix version (and bennu for the bennu version when that one arrives).

SWAT made a folder called dll, he coded it so custom dll's made for the dreamcast version will load.

play_wav did not work in his current release

Nor could I find the code that supposedly looks for autorun.dcb lol

His folder is not complete, you will need the other parts of fenix, but anything edited for the dreamcast is in those folders

werg

l1nk3rn3l

our group have a DC port..

is soon to release.. And possibly with dll support   :o

in few days...



MisterN

#57
cool, have you looked at any of the tutorials to get the vmu to work?
http://dcemulation.org/phpBB/viewtopic.php?f=29&t=97486
http://dcemulation.org/phpBB/viewtopic.php?f=29&t=72958&hilit=vmu+image

will there be a .dll for playing a movie file from the get go? someone told me they got smpeg compiled once and at 320x240 it ran at 15fps, which i guess is ok lol.

Do you think you can make a program to change the display VMU?
werg