#ifndef COMPILE_H
#include "COMPILE.H"
#endif
#ifdef MEDIA749_A36M_A31E_A31M_A33M_A35E_A35M_X31J
extern FTL_LIBRARY* F9008_OpenPRIM();
extern FTL_LIBRARY* F9000_OpenGRF1();
extern FTL_LIBRARY* F9004_OpenVDEO();
extern FTL_LIBRARY* F9018_OpenINT1();
extern FTL_LIBRARY* F9016_OpenMUSC();

FTL_EXECUTABLE* G3134_PRIM_Executable;
#ifdef MEDIA692_X31J
FTL_LIBRARY* G3138_MUSC_Library;
FTL_LIBRARY* G3136_VDEO_Library;
FTL_LIBRARY* G3135_GRF1_Library;
FTL_LIBRARY* G3137_INT1_Library;
#endif

void F1046_OpenLibraries(FTL_LIBRARY* P2786_, FTL_EXECUTABLE* P2787_) {
        G3134_PRIM_Executable = P2787_;
#ifdef MEDIA757_A36M_A31M_A33M_A35M
        G2000_Language = G3134_PRIM_Executable->Parameter & 3;
#endif
        if (F9008_OpenPRIM(P2786_, 2) == NULL) {
                F0019_MAIN_DisplayErrorAndStop(C80_ERROR_FAILED_LOADING_PRIM);
                return;
        }
#ifdef MEDIA692_X31J
        if ((G3135_GRF1_Library = F9000_OpenGRF1(2)) == NULL) {
                F0019_MAIN_DisplayErrorAndStop(C81_ERROR_FAILED_LOADING_GRF1);
                return;
        }
        if ((G3136_VDEO_Library = F9004_OpenVDEO(3)) == NULL) {
                F0019_MAIN_DisplayErrorAndStop(C82_ERROR_FAILED_LOADING_VDEO);
                return;
        }
        if ((G3137_INT1_Library = F9018_OpenINT1(3)) == NULL) {
                F0019_MAIN_DisplayErrorAndStop(C84_ERROR_FAILED_LOADING_INT1);
                return;
        }
        if ((G3138_MUSC_Library = F9016_OpenMUSC(3)) == NULL) {
                F0019_MAIN_DisplayErrorAndStop(C83_ERROR_FAILED_LOADING_MUSC);
                return;
        }
#endif
        P2787_->Parameter = FTL_APPB;
}

void F1047_CloseLibraries(
)
{
#ifdef MEDIA692_X31J
        F9017_CloseMUSC(G3138_MUSC_Library);
        F9019_CloseINT1(G3137_INT1_Library);
        F9005_CloseVDEO(G3136_VDEO_Library);
        F9001_CloseGRF1(G3135_GRF1_Library);
#endif
        F9009_ClosePRIM();
}
#endif
