Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
181 user(s) are online (164 user(s) are browsing Forums)

Members: 1
Guests: 180

AmigaSociety, more...

Support us!

Headlines

 
  Register To Post  

« 1 ... 9 10 11 (12) 13 14 15 ... 22 »
Re: Porting to AmigaOS4 thread
Just can't stay away
Just can't stay away


See User information
@LiveForIt

I'm not proposing to do both. Either manual OpenLibrary + GetInterface or -lauto.

Go to top
Re: Porting to AmigaOS4 thread
Home away from home
Home away from home


See User information
@Capehill

Is there example code somewhere?
For an amigaos4 suitable solution...as easy as it can get, please

Go to top
Re: Porting to AmigaOS4 thread
Just can't stay away
Just can't stay away


See User information
@Raziel

Here is one example regarding manual opening of the asl.library: https://github.com/capehill/MilkyTrack ... iga/AslRequester.cpp#L110

Jabirulo made one too.

I was fetching the latest ScummVM sources yesterday so I can try to assist, but I need your changes + new files.

Go to top
Re: Porting to AmigaOS4 thread
Home away from home
Home away from home


See User information
@Capehill

On it, thank you, i'll shout if/when i get stuck again

Go to top
Re: Porting to AmigaOS4 thread
Home away from home
Home away from home


See User information
@Capehill

Could you help me to
1 - get rid of the warnings
2 - to use utf8
3 - polish (or rather fix) the code
please

especially utf8 is way beyond me

Thank you

These are the warnings and the utf8 error
C++      backends/dialogs/amigaos/amigaos-dialogs.o
backends
/dialogs/amigaos/amigaos-dialogs.cppIn member function 'virtual Common::DialogManager::DialogResult AmigaOSDialogManager::showFileBrowser(const Common::U32String&, Common::FSNode&, bool)':
backends/dialogs/amigaos/amigaos-dialogs.cpp:44:18warningdeclaration of 'AslBase' shadows a global declaration [-Wshadow]
  
struct Library *AslBase IExec->OpenLibrary("asl.library"50);
                  ^~~~~~~
In file included from backends/dialogs/amigaos/amigaos-dialogs.cpp:38:
/
SDK/include/include_h/proto/asl.h:30:27noteshadowed declaration is here
   extern struct Library 
AslBase;
                           ^~~~~~~
backends/dialogs/amigaos/amigaos-dialogs.cpp:45:19warningdeclaration of 'IAsl' shadows a global declaration [-Wshadow]
  
struct AslIFace *IAsl NULL;
                   ^~~~
In file included from backends/dialogs/amigaos/amigaos-dialogs.cpp:38:
/
SDK/include/include_h/proto/asl.h:47:27noteshadowed declaration is here
   extern struct AslIFace 
*IAsl;
                           ^~~~
backends/dialogs/amigaos/amigaos-dialogs.cpp:65:56warningcast from type 'const value_type*' {aka 'const char*'to type 'char*' casts away qualifiers [-Wcast-qual]
   
char *newTitle utf8ToLocal((char *)utf8Title.c_str());
                                                        ^
    
AR       backends/libbackends.a
    RANLIB   backends
/libbackends.a
    C
++      base/version.o
    AR       base
/libbase.a
    RANLIB   base
/libbase.a
    LINK     scummvm
backends
/libbackends.a(amigaos-dialogs.o): In function `Common::SharedPtrDeletionInternal::~SharedPtrDeletionInternal()':
./common/ptr.h:43: undefined reference to 
`AmigaOSDialogManager::utf8ToLocal(char*)'
gmake: *** [scummvm] Error 1


and here is amigaos-dialogs.cpp
/* ScummVM - Graphic Adventure Engine
 *
 * ScummVM is the legal property of its developers, whose names
 * are too numerous to list here. Please refer to the COPYRIGHT
 * file distributed with this source distribution.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 */

#define FORBIDDEN_SYMBOL_EXCEPTION_FILE
#define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h
#define FORBIDDEN_SYMBOL_EXCEPTION_time_h
#define FORBIDDEN_SYMBOL_EXCEPTION_strdup
#include "common/scummsys.h"

#if defined(__amigaos4__) && defined(USE_SYSDIALOGS)

#include "backends/dialogs/amigaos/amigaos-dialogs.h"

#include "common/config-manager.h"
#include "common/encoding.h"

#include <proto/exec.h>
#include <proto/dos.h>
#include <proto/asl.h>

Common::DialogManager::DialogResult AmigaOSDialogManager::showFileBrowser(const Common::U32String &titleCommon::FSNode &choicebool isDirBrowser) {

    
char pathBuffer[MAXPATHLEN];

    
struct Library *AslBase IExec->OpenLibrary("asl.library"50);
    
struct AslIFace *IAsl NULL;

    
DialogResult result kDialogCancel;
    
Common::String utf8Title title.encode();

    
IAsl = (struct AslIFace*)IExec->GetInterface(AslBase"main"1NULL);

    if (
AslBase) {

        
struct FileRequester *fr NULL;

        if (
ConfMan.hasKey("browser_lastpath")) {
            
strncpy(pathBufferConfMan.get("browser_lastpath").c_str(), sizeof(pathBuffer) - 1);
        }

        
fr = (struct FileRequester *)IAsl->AllocAslRequestTags(ASL_FileRequestTAG_DONE);

        if (!
fr)
            return 
result;

        
char *newTitle utf8ToLocal((char *)utf8Title.c_str());

        if (
IAsl->AslRequestTags(frASLFR_TitleTextnewTitleASLFR_RejectIconsTRUEASLFR_InitialDrawerpathBufferASLFR_DrawersOnly, (isDirBrowser TRUE FALSE), TAG_DONE)) {

            if (
strlen(fr->fr_Drawer) < sizeof(pathBuffer)) {
                
strncpy(pathBufferfr->fr_Drawersizeof(pathBuffer));
                if (!
isDirBrowser) {
                    
IDOS->AddPart(pathBufferfr->fr_Filesizeof(pathBuffer));
                }
                
choice Common::FSNode(pathBuffer);
                
ConfMan.set("browser_lastpath"pathBuffer);
                
result kDialogOk;
            }
        }

        
free(newTitle);
        
IAsl->FreeAslRequest((APTR)fr);
        
IExec->CloseLibrary(AslBase);
    }

    return 
result;
}

#endif

Go to top
Re: Porting to AmigaOS4 thread
Just can't stay away
Just can't stay away


See User information
@Raziel

Not sure but try this, and hope it removes some ASL warnings.


...
#include <proto/exec.h>
#include <proto/dos.h>
#include <proto/asl.h>

extern struct Library *AslBase;
extern struct AslIFace *IAsl;


Common::DialogManager::DialogResult AmigaOSDialogManager::showFileBrowser(const Common::U32String &titleCommon::FSNode &choicebool isDirBrowser) {

    
char pathBuffer[MAXPATHLEN];

    
AslBase IExec->OpenLibrary("asl.library"50);

    
DialogResult result kDialogCancel;
    
Common::String utf8Title title.encode();

    if (
AslBase) {

IAsl = (struct AslIFace*)IExec->GetInterface(AslBase"main"1NULL);

        
struct FileRequester *fr NULL;

        if (
ConfMan.hasKey("browser_lastpath")) {
            
strncpy(pathBufferConfMan.get("browser_lastpath").c_str(), sizeof(pathBuffer) - 1);
        }

        
fr = (struct FileRequester *)IAsl->AllocAslRequestTags(ASL_FileRequestTAG_DONE);

        if (!
fr)
            return 
result;

        
char *newTitle utf8ToLocal((char *)utf8Title.c_str());

        if (
IAsl->AslRequestTags(frASLFR_TitleTextnewTitleASLFR_RejectIconsTRUEASLFR_InitialDrawerpathBufferASLFR_DrawersOnly, (isDirBrowser TRUE FALSE), TAG_DONE)) {

            if (
strlen(fr->fr_Drawer) < sizeof(pathBuffer)) {
                
strncpy(pathBufferfr->fr_Drawersizeof(pathBuffer));
                if (!
isDirBrowser) {
                    
IDOS->AddPart(pathBufferfr->fr_Filesizeof(pathBuffer));
                }
                
choice Common::FSNode(pathBuffer);
                
ConfMan.set("browser_lastpath"pathBuffer);
                
result kDialogOk;
            }
        }

        
free(newTitle);
        
IAsl->FreeAslRequest((APTR)fr);
IExec->DropInterface((struct Interface*)IAsl);
        
IExec->CloseLibrary(AslBase);
    }

    return 
result;
}

#endif


In case it warns about:
extern struct Library *AslBase;
extern struct AslIFace *IAsl;
just comment them out.


Edited by jabirulo on 2020/11/20 12:25:33
Go to top
Re: Porting to AmigaOS4 thread
Home away from home
Home away from home


See User information
@jabirulo

I need to add i have no idea how to incorporate the utf8 stuff

backends/dialogs/amigaos/amigaos-dialogs.cppIn member function 'virtual Common::DialogManager::DialogResult AmigaOSDialogManager::showFileBrowser(const Common::U32String&, Common::FSNode&, bool)':
backends/dialogs/amigaos/amigaos-dialogs.cpp:67:56warningcast from type 'const value_type*' {aka 'const char*'to type 'char*' casts away qualifiers [-Wcast-qual]
   
char *newTitle utf8ToLocal((char *)utf8Title.c_str());
                                                        ^
backends/libbackends.a(amigaos-dialogs.o): In function `Common::SharedPtrDeletionInternal::~SharedPtrDeletionInternal()':
./common/ptr.h:43: undefined reference to 
`AslBase'
./common/ptr.h:43: undefined reference to `AslBase'
./common/ptr.h:43undefined reference to `AslBase'
./common/ptr.h:43: undefined reference to 
`IAsl'
./common/ptr.h:43: undefined reference to `IAsl'
./common/ptr.h:43undefined reference to `IAsl'
./common/ptr.h:43: undefined reference to 
`AmigaOSDialogManager::utf8ToLocal(char*)'
./common/ptr.h:43: undefined reference to `IAsl'
./common/ptr.h:43undefined reference to `IAsl'
./common/ptr.h:43: undefined reference to 
`IAsl'
./common/ptr.h:43: undefined reference to `AslBase'
gmake: *** [scummvmError 1

Go to top
Re: Porting to AmigaOS4 thread
Just can't stay away
Just can't stay away


See User information
@Raziel

Maybe you need to put those definitions:
extern struct Library *AslBase;
extern struct AslIFace *IAsl;
on top of amigaos-dialogs.cpp, before includes.


BTW I forget to "NULLify" ASL variables at end:
Exec->DropInterface((struct Interface*)IAsl);
IAsl = NULL;
IExec->CloseLibrary(AslBase);
AslBase = NULL;

Go to top
Re: Porting to AmigaOS4 thread
Home away from home
Home away from home


See User information
@jabirulo

Nope, still undefined refs on linking...the two extern structs are still inisde the if defined __amigaos4__

C++      backends/dialogs/amigaos/amigaos-dialogs.o
backends
/dialogs/amigaos/amigaos-dialogs.cppIn member function 'virtual Common::DialogManager::DialogResult AmigaOSDialogManager::showFileBrowser(const Common::U32String&, Common::FSNode&, bool)':
backends/dialogs/amigaos/amigaos-dialogs.cpp:67:56warningcast from type 'const value_type*' {aka 'const char*'to type 'char*' casts away qualifiers [-Wcast-qual]
   
char *newTitle utf8ToLocal((char *)utf8Title.c_str());
                                                        ^
    
AR       backends/libbackends.a
    RANLIB   backends
/libbackends.a
    C
++      base/version.o
    AR       base
/libbase.a
    RANLIB   base
/libbase.a
    LINK     scummvm
backends
/libbackends.a(amigaos-dialogs.o): In function `Common::SharedPtrDeletionInternal::~SharedPtrDeletionInternal()':
./common/ptr.h:43: undefined reference to 
`AslBase'
./common/ptr.h:43: undefined reference to `AslBase'
./common/ptr.h:43undefined reference to `AslBase'
./common/ptr.h:43: undefined reference to 
`IAsl'
./common/ptr.h:43: undefined reference to `IAsl'
./common/ptr.h:43undefined reference to `IAsl'
./common/ptr.h:43: undefined reference to 
`AmigaOSDialogManager::utf8ToLocal(char*)'
./common/ptr.h:43: undefined reference to `IAsl'
./common/ptr.h:43undefined reference to `IAsl'
./common/ptr.h:43: undefined reference to 
`IAsl'
./common/ptr.h:43: undefined reference to `IAsl'
./common/ptr.h:43undefined reference to `AslBase'
./common/ptr.h:43: undefined reference to 
`AslBase'
gmake: *** [scummvm] Error 1

Go to top
Re: Porting to AmigaOS4 thread
Just can't stay away
Just can't stay away


See User information
@Raziel

Try tu put amigaos-dialogs.o as first file of linking objects.

Go to top
Re: Porting to AmigaOS4 thread
Home away from home
Home away from home


See User information
@jabirulo

That won't be as easy, the objects to link are hardcoded within the scummvm configuration.

If i i change it once i'll have to change it everytime new code arrives...

Go to top
Re: Porting to AmigaOS4 thread
Just can't stay away
Just can't stay away


See User information
How is amigaos-dialogs.cpp added in the makefile (or whatever file makes the build)?

Can you see on your Shell/CLI/terminal the whole linking line/commandline?

Maybe just copy&paste such linking line in a self made script and the you execute such script manually.

Go to top
Re: Porting to AmigaOS4 thread
Just can't stay away
Just can't stay away


See User information
@Raziel

Don't use "extern". Also move Asl symbols outside the function to avoid "shadowing" warnings. In proto/asl.h symbols are declared as globals that's why compiler was worried.

struct LibraryAslBase;
struct AslIFaceIAsl;

void YourAslCallingFunction() {
// IAsl calls ...
}


utf8ToLocal: as said you need to implement this function in the cpp. Check the corresponding MorphOS implementation.


Go to top
Re: Porting to AmigaOS4 thread
Home away from home
Home away from home


See User information
@Capehill
@jabirulo

Boy, this compiler is picky

I managed to move around stuff so i get it to build without warnings, thanks a lot for the help

Now i'd like to implement the utf8 stuff (noob here aswell) but MorpHOS seems to use some stuff that is not available, or maybe i hvaenßt found it in the SDK (yet)?

This is the codesets part i have in now
#if defined(__amigaos4__) && defined(USE_SYSDIALOGS)

#include "backends/dialogs/amigaos/amigaos-dialogs.h"

#include "common/config-manager.h"
#include "common/encoding.h"

#include <libraries/codesets.h>

#include <proto/asl.h>
#include <proto/dos.h>
#include <proto/exec.h>

char *AmigaOSDialogManager::utf8ToLocal(char *in) {

    if (!
in) {
        return 
strdup("");
    }

    
struct Library *CodesetsBase IExec->OpenLibrary("codesets.library"6);
    if (
CodesetsBase) {

        
LONG dstmib CSA_DestCodeset(NULL0);
        if (
dstmib != CS_MIBENUM_INVALID) {
            
LONG dstlen FSGetByteSize((APTR)in, -1CS_MIBENUM_UTF_8dstmib);
            
char *out = (char *)malloc(dstlen 1);
            if (
out) {
                if (
ConvertTagList((APTR)in, -1, (APTR)out, -1CS_MIBENUM_UTF_8dstmibNULL) != -1) {
                    return 
out;
                }
                
free(out);
            }
        }
        
IExec->CloseLibrary(CodesetsBase);
    }

    return 
strdup(in);
}
...

But i get compiler errors and warnings...do i miss an include, maybe?

Especially FSGetByteSize and ConvertTagList seem to be nowhere in my SDK.

And what does that "expression cannot be used as function" mean?

C++      backends/dialogs/amigaos/amigaos-dialogs.o
backends
/dialogs/amigaos/amigaos-dialogs.cppIn member function 'char* AmigaOSDialogManager::utf8ToLocal(char*)':
backends/dialogs/amigaos/amigaos-dialogs.cpp:52:40errorexpression cannot be used as function
   
LONG dstmib CSA_DestCodeset(NULL0);
                                        ^
backends/dialogs/amigaos/amigaos-dialogs.cpp:54:18error'FSGetByteSize' was not declared in this scope
    LONG dstlen 
FSGetByteSize((APTR)in, -1CS_MIBENUM_UTF_8dstmib);
                  ^~~~~~~~~~~~~
backends/dialogs/amigaos/amigaos-dialogs.cpp:54:18notesuggested alternative'FSGetFileSize'
    
LONG dstlen FSGetByteSize((APTR)in, -1CS_MIBENUM_UTF_8dstmib);
                  ^~~~~~~~~~~~~
                  
FSGetFileSize
backends
/dialogs/amigaos/amigaos-dialogs.cpp:57:9error'ConvertTagList' was not declared in this scope
     
if (ConvertTagList((APTR)in, -1, (APTR)out, -1CS_MIBENUM_UTF_8dstmibNULL) != -1) {
         ^~~~~~~~~~~~~~
backends/dialogs/amigaos/amigaos-dialogs.cpp:57:9notesuggested alternative'convertMsg'
     
if (ConvertTagList((APTR)in, -1, (APTR)out, -1CS_MIBENUM_UTF_8dstmibNULL) != -1) {
         ^~~~~~~~~~~~~~
         
convertMsg
backends
/dialogs/amigaos/amigaos-dialogs.cppIn member function 'virtual Common::DialogManager::DialogResult AmigaOSDialogManager::showFileBrowser(const Common::U32String&, Common::FSNode&, bool)':
backends/dialogs/amigaos/amigaos-dialogs.cpp:93:56warningcast from type 'const value_type*' {aka 'const char*'to type 'char*' casts away qualifiers [-Wcast-qual]
   
char *newTitle utf8ToLocal((char *)utf8Title.c_str());
                                                        ^
gmake: *** [backends/dialogs/amigaos/amigaos-dialogs.oError 1


Thanks for all the help guys, really appreciated...not that i'll learn much from it, but, yeah

Go to top
Re: Porting to AmigaOS4 thread
Just can't stay away
Just can't stay away


See User information
@Raziel

You need to add IFace:
struct CodesetsIFace *ICodesets = NULL;
...
ICodesets = GetInterface((struct Library *)(Codesetbase), "main", 1L, NULL);


and close at exit/end:
DropInterface( (struct Interface *)ICodesets );
ICodesets = NULL;
...

Are those missing functions part of MorphOS/OtherOS?
Or part of your port/sources?
If part of MorphOS, check MorphOS sdk autodocs and see such functions and then try to amigaos4'ize thrm.

EDIT: seems theyu a part of MorphOS charset autodoc:
charsets.library/ConvertTagList()
charsets.library/GetByteSize()

Yo can try to adapt parts in convert.c example (codesets archive) and replace in your port/sources.

Go to top
Re: Porting to AmigaOS4 thread
Home away from home
Home away from home


See User information
@jabirulo

Thank you, funny it didn't warn me about those.

Will try to find some info for FSGetByteSize and ConvertTags, thanks for the hints

Go to top
Re: Porting to AmigaOS4 thread
Just can't stay away
Just can't stay away


See User information
@Raziel

I think the missing ICodesets will shown only on linking stage.


codesets has somethiong like "ConvertTagList":

char *destbuf = CodesetsConvertStr(
CSA_SourceCodeset, srcCodeset,
CSA_DestCodeset, destCodeset,
CSA_Source, buf,
CSA_DestLenPtr, &destlen,
TAG_DONE);

You just need to "fill the gaps/variables" (convert.c example)

Go to top
Re: Porting to AmigaOS4 thread
Home away from home
Home away from home


See User information
@jabirulo

That's what i thought too, but there were no linking errors.
Anyway, i've placed these lines now, shouldn't hurt.

"Filling in the gaps"...yes, but if you don't know the language you might get in trouble, just like with a gap text exam

Go to top
Re: Porting to AmigaOS4 thread
Just can't stay away
Just can't stay away


See User information
@Raziel
ok, ok.
I already used such function/method, will post it here ASAP and hope it will work for you.

Go to top
Re: Porting to AmigaOS4 thread
Home away from home
Home away from home


See User information
@jabirulo

Thank you, but it was not meant to throw the ball back to you.

I was going fo look up those functions, just not right now

Go to top

  Register To Post
« 1 ... 9 10 11 (12) 13 14 15 ... 22 »

 




Currently Active Users Viewing This Thread: 6 ( 0 members and 6 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project