Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
40 user(s) are online (26 user(s) are browsing Forums)

Members: 1
Guests: 39

billyfish, more...

Support us!

Headlines

Report message:*
 

Re: Porting to AmigaOS4 thread

Subject: Re: Porting to AmigaOS4 thread
by jabirulo on 2020/11/20 11:57:14

@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.

Powered by XOOPS 2.0 © 2001-2016 The XOOPS Project