static void weird_doc (Lisp_Object sym, const Ascbyte *weirdness, const Ascbyte *type, int pos) { if (!strcmp (weirdness, "duplicate")) return; message ("Note: Strange doc (%s) for %s %s @ %d", GETTEXT (weirdness), GETTEXT (type), XSTRING_DATA (XSYMBOL (sym)->name), pos); }
BOOL CWndChat::Initialize(CWndBase* pWndParent,DWORD dwWndId) { CRect rectWindow = m_pWndRoot->GetWindowRect(); CRect rect( 154, rectWindow.Height() - 100, 154 + rectWindow.Width() - 300, rectWindow.Height() ); SetTitle( GETTEXT( TID_APP_COMMUNICATION_CHAT ) ); return CWndNeuz::InitDialog( g_Neuz.GetSafeHwnd(), dwWndId, WBS_KEY| WBS_THICKFRAME, CPoint( 792, 130 ), pWndParent ); //return CWndNeuz::Create( 0|WBS_MOVE|/*WBS_DOCKABLE|*/WBS_SOUND|WBS_CAPTION|WBS_THICKFRAME|WBS_MAXIMIZEBOX, rect, &g_WndMng, dwWndId); }
BOOL CWndSelectAwakeCase::OnChildNotify( UINT message, UINT nID, LRESULT* pLResult ) { if( nID == WIDC_BUTTON1 ) { g_DPlay.SendSelectedAwakeningValue( m_byObjID, m_dwSerialNum, _AWAKE_OLD_VALUE ); g_WndMng.PutString( GETTEXT( TID_GAME_REGARDLESS_USE03 ) ); //선택됨 Destroy(); } else if( nID == WIDC_BUTTON2 ) { g_DPlay.SendSelectedAwakeningValue( m_byObjID, m_dwSerialNum, _AWAKE_NEW_VALUE ); g_WndMng.PutString( GETTEXT( TID_GAME_REGARDLESS_USE03 ) ); //선택됨 Destroy(); } return CWndNeuz::OnChildNotify( message, nID, pLResult ); }
static ad_device_data * sound_ao_create(Lisp_Object ao_options) { int driver; ao_device *device; ao_option *options; ao_sample_format *fmt; /* result */ sound_ao_data_t *aod; /* option keywords */ Lisp_Object opt_driver; char *optext_driver = NULL; /* parse options */ opt_driver = Fplist_get(ao_options, intern(":driver"), Qnil); if (!NILP(opt_driver) && !STRINGP(opt_driver)) { wrong_type_argument(Qstringp, opt_driver); return NULL; } else if (STRINGP(opt_driver)) optext_driver = (char*)XSTRING_DATA(opt_driver); /* -- initialise -- */ ao_initialize(); fmt = xmalloc(sizeof(ao_sample_format)); /* -- Setup for driver -- */ if (optext_driver != NULL) driver = ao_driver_id(optext_driver); else driver = ao_default_driver_id(); /* just some generics */ fmt->channels = 2; fmt->rate = 44100; fmt->bits = 16; fmt->byte_format = AO_FMT_LITTLE; options = NULL; /* -- Open driver -- */ device = ao_open_live(driver, fmt, options); if (device == NULL) { message(GETTEXT("audio-ao: Unsupported driver.")); xfree(fmt); aod = NULL; } else { aod = xnew_and_zero(sound_ao_data_t); aod->ad = device; aod->options = NULL; aod->fmt = fmt; aod->driver_id = driver; } return aod; }
static ad_device_data * sound_nas_create(Lisp_Object nas_options) { sound_nas_data_t *snd; char *server[6] = {NULL, NULL, NULL, NULL, NULL, NULL}; int i, server_cnt = 0; AuServer *aud = NULL; Lisp_Object opt_server = Qnil; /* parse options */ opt_server = Fplist_get(nas_options, intern(":server"), Qnil); if (!NILP(opt_server) && !STRINGP(opt_server) && !DEVICEP(opt_server)) { wrong_type_argument(Qstringp, opt_server); return NULL; } if (NILP(opt_server)) nas_setup_defaults(server, &server_cnt); else if (STRINGP(opt_server)) server[server_cnt++] = (char*)XSTRING_DATA(opt_server); #ifdef HAVE_X_WINDOWS else if (DEVICEP(opt_server) && DEVICE_X_P(XDEVICE(opt_server))) server[server_cnt++] = (char*)XSTRING_DATA( DEVICE_CONNECTION(XDEVICE(opt_server))); #endif NAS_DEBUG("trying %d connections\n", server_cnt); for (i = 0; i<server_cnt; i++) if ((aud = nas_try_connection(server[i]))) break; if (!aud) { NAS_DEBUG_C("cannot contact any NAS server\n"); warn_when_safe(Qnas, Qwarning, GETTEXT("No NAS servers in sight.\n")); return NULL; /* Could not contact NAS server */ } /* -- initialise -- */ snd = xnew_and_zero(sound_nas_data_t); snd->aud = aud; /* round up SOUND_MAX_AUDIO_FRAME_SIZE to multiple of NAS_FRAG_SIZE * divide by 3 first because of 2:1 split */ snd->proposed_buffer_size = (SOUND_MAX_AUDIO_FRAME_SIZE/3 + NAS_FRAG_SIZE-1) & ~(NAS_FRAG_SIZE-1); NAS_DEBUG_C("proposed buffer size: %u\n", snd->proposed_buffer_size); NAS_DEBUG_C("created: 0x%x\n", (unsigned int)snd); return snd; }
void CWndSelectAwakeCase::OnDraw( C2DRender* p2DRender ) { if( !g_pPlayer ) return; CItemElem* pItemElem = (CItemElem*)g_pPlayer->GetItemId( m_byObjID ); if( !pItemElem ) { assert( 0 ); return; } m_dwDeltaTime += (g_tmCurrent - m_dwOldTime); m_dwOldTime = g_tmCurrent; if( m_dwDeltaTime > AWAKE_KEEP_TIME ) { //제한시간이 지나면 현재옵션으로 요청 g_DPlay.SendSelectedAwakeningValue( m_byObjID, m_dwSerialNum, _AWAKE_OLD_VALUE ); g_WndMng.PutString( GETTEXT( TID_GAME_REGARDLESS_USE02 ) ); //선택시간 초과 m_dwDeltaTime = 0; Destroy(); } //old OutputOptionString( p2DRender, pItemElem ); //new OutputOptionString( p2DRender, pItemElem, TRUE ); CRect rect = GetWindowRect(); rect.left += 14; rect.top += 174; // 시간 / 100 * 360(총길이) / 600 (총시간) rect.right = LONG(( rect.left + (AWAKE_KEEP_TIME - m_dwDeltaTime) / 100 ) * 0.6f) ; //귀찮으니 걍 바의 길이를 최대초로... rect.bottom = rect.top + 20; // if( m_pTexGuage ) // p2DRender->RenderFillRect( rect, 0xffff0000, m_pTexGuage->m_pTexture ); m_pTheme->RenderGauge(p2DRender, &rect, 0xffffffff, m_pVertexBufferGauge, m_pTexGuage); // draw icon LPWNDCTRL wndCtrl = GetWndCtrl( WIDC_STATIC1 ); assert( wndCtrl ); if(m_pTexture) m_pTexture->Render( p2DRender, CPoint( wndCtrl->rect.left, wndCtrl->rect.top ) ); }
BOOL CWndGHUpkeep::Initialize( CWndBase* pWndParent, DWORD dwWndId ) { InitDialog( g_Neuz.GetSafeHwnd(), APP_CONFIRM_BUY_, 0, 0, pWndParent ); MoveParentCenter(); SetTitle( GETTEXT( TID_GAME_GUILDHOUSE_TAXUI01 ) ); //유지비 CWndStatic* pLabel = (CWndStatic *)GetDlgItem( WIDC_STATIC ); pLabel->SetTitle( "" ); pLabel = (CWndStatic *)GetDlgItem( WIDC_STATIC1 ); pLabel->SetTitle( GETTEXT( TID_GAME_GUILDHOUSE_TAXUI03 ) ); //납부금액 m_pEdit = (CWndEdit *)GetDlgItem( WIDC_CONTROL2 ); m_pStatic = (CWndStatic *)GetDlgItem( WIDC_CONTROL1 ); m_pStatic->SetTitle( GETTEXT( TID_GAME_GUILDHOUSE_TAXUI02 ) ); //유지기간 m_pStaticGold = (CWndStatic *)GetDlgItem( WIDC_STATIC2 ); m_pStaticGold->AddWndStyle(WSS_MONEY); OnChangeBuyCount( 1 ); return TRUE; }
BOOL CWndGHMainMenu::Process() { CWndStatic* pEndTime = (CWndStatic*)GetDlgItem( WIDC_STATIC2 ); if( !pEndTime ) return FALSE; time_t t = (time_t)GuildHouse->GetUpkeepTime() - time_null(); if(t < 0) { pEndTime->SetTitle( GETTEXT( TID_GAME_GUILDHOUSE_EXPIRATION ) ); return TRUE; } CTimeSpan ts( t ); static CString strDays, strHours, strMins, strSecs; CString strBind; const CString strSpace = " "; if( ts.GetDays( ) ) { strDays.Format( prj.GetText( TID_PK_LIMIT_DAY ), ts.GetDays() ); strBind += ( strSpace + strDays ); } if( ts.GetHours( ) ) { strHours.Format( prj.GetText(TID_PK_LIMIT_HOUR ), ts.GetHours() ); strBind += ( strSpace + strHours ); } if( ts.GetMinutes( ) ) { strMins.Format( prj.GetText(TID_PK_LIMIT_MINUTE ), ts.GetMinutes() ); strBind += ( strSpace + strMins ); } if( ts.GetSeconds( ) ) { strSecs.Format( prj.GetText(TID_PK_LIMIT_SECOND ), ts.GetSeconds() ); strBind += ( strSpace + strSecs ); } pEndTime->SetTitle( strBind ); return TRUE; }
static AuServer * nas_try_connection(char *server) { AuServer *result = NULL; char *err_message = NULL; /* open server */ NAS_DEBUG_C("trying to contact NAS server: %s\n", server); message(GETTEXT("trying to contact NAS server at %s..."), server); result = AuOpenServer(server, 0, NULL, 0, NULL, &err_message); if (!result) { NAS_DEBUG_C("cannot contact NAS server: %s\n", (err_message ? err_message : ":(")); } return result; }
void _test_func( std::vector< string >& arg ) { BOOL bAuthority = FALSE; CGuild* pGuild = g_pPlayer->GetGuild( ); if( pGuild ) bAuthority = pGuild->IsAuthority( g_pPlayer->m_idPlayer, PF_GUILDHOUSE_UPKEEP ); if( !bAuthority ) //유지비 권한이 없으면 { g_WndMng.PutString( GETTEXT( TID_GAME_GUILDHOUSE_TAX_LEVEL ) ); return; } if( !g_WndMng.m_pWndUpkeep ) { g_WndMng.m_pWndUpkeep = new CWndGHUpkeep; g_WndMng.m_pWndUpkeep->Initialize(&g_WndMng, APP_CONFIRM_BUY_); } }
void clispErrDie(void) { error(error_condition,GETTEXT("PARI error")); }
BOOL CWndGHMainMenu::OnChildNotify( UINT message, UINT nID, LRESULT* pLResult ) { switch( nID ) { case WIDC_BTN_SETUPPOWER: //권한 { CWndGuild* pWnd = (CWndGuild*)g_WndMng.GetApplet( APP_GUILD ); if( pWnd ) pWnd->Destroy( ); else { g_WndMng.CreateApplet( APP_GUILD ); pWnd = (CWndGuild*)g_WndMng.GetApplet( APP_GUILD ); assert( pWnd ); pWnd->SetCurTab( 4 ); //권한 tab으로 ! } } break; case WIDC_BTN_FURNITURE: //가구창 { CWndGuildHousing* pWnd = (CWndGuildHousing*)g_WndMng.GetApplet( APP_GH_FURNITURE_STORAGE ); if( pWnd ) { if( pWnd->IsSection( CWndGuildHousing::GS_FURNITURE ) ) pWnd->Destroy( ); else if( pWnd->IsSection( CWndGuildHousing::GS_TELEPORTER ) ) //텔레포터랑 같은 윈도를 쓰기때문에 텔레포터창 죽이고 가구창 열게함. pWnd->InitBySection( CWndGuildHousing::GS_FURNITURE ); } else { g_WndMng.CreateApplet( APP_GH_FURNITURE_STORAGE ); CWndGuildHousing* pWnd = (CWndGuildHousing*)g_WndMng.GetApplet( APP_GH_FURNITURE_STORAGE ); assert( pWnd ); pWnd->InitBySection( CWndGuildHousing::GS_FURNITURE ); } } break; case WIDC_BTN_STORAGE: //창고 { if( g_WndMng.m_pWndGuildBank ) { g_DPlay.SendCloseGuildBankWnd(); g_WndMng.m_pWndGuildBank->Destroy( ); g_WndMng.m_pWndGuildBank = NULL; } else g_DPlay.SendOpenGuildBankWnd(); break; } break; case WIDC_BTN_TELEPORTER: //텔레포터 { CWndGuildHousing* pWnd = (CWndGuildHousing*)g_WndMng.GetApplet( APP_GH_FURNITURE_STORAGE ); if( pWnd ) { if( pWnd->IsSection( CWndGuildHousing::GS_TELEPORTER ) ) pWnd->Destroy( ); else if( pWnd->IsSection( CWndGuildHousing::GS_FURNITURE ) ) pWnd->InitBySection( CWndGuildHousing::GS_TELEPORTER ); } else { g_WndMng.CreateApplet( APP_GH_FURNITURE_STORAGE ); pWnd = (CWndGuildHousing*)g_WndMng.GetApplet( APP_GH_FURNITURE_STORAGE ); assert( pWnd ); pWnd->InitBySection( CWndGuildHousing::GS_TELEPORTER ); } } break; case WIDC_BTN_UPKEEP: //유지비 { BOOL bAuthority = FALSE; CGuild* pGuild = g_pPlayer->GetGuild( ); if( pGuild ) bAuthority = pGuild->IsAuthority( g_pPlayer->m_idPlayer, PF_GUILDHOUSE_UPKEEP ); if( !bAuthority ) //유지비 권한이 없으면 { g_WndMng.PutString( GETTEXT( TID_GAME_GUILDHOUSE_TAX_LEVEL ) ); break; } if( !g_WndMng.m_pWndUpkeep ) { g_WndMng.m_pWndUpkeep = new CWndGHUpkeep; g_WndMng.m_pWndUpkeep->Initialize(&g_WndMng, APP_CONFIRM_BUY_); }else { g_WndMng.m_pWndUpkeep->Destroy( ); g_WndMng.m_pWndUpkeep = NULL; } } break; } return CWndNeuz::OnChildNotify( message, nID, pLResult ); }
// 승자에게 칩지급하고 메세지 출력(패자는 메세지만 출력) void CGuildCombat1to1::SetWinChip( CUser* pUserWin, CUser* pUserLost, BOOL bDraw, BOOL bDiag ) { if( bDraw ) // 비겼을 때(칩 지급 안하고 메세지만 출력) { if( bDiag ) // 개인 승패만 메세지 박스 출력 { if( IsPossibleUser( pUserWin ) ) pUserWin->AddDiagText( prj.GetText( TID_GAME_GUILDCOMBAT_1TO1_WARDRAW ) ); if( IsPossibleUser( pUserLost ) ) pUserLost->AddDiagText( prj.GetText( TID_GAME_GUILDCOMBAT_1TO1_WARDRAW ) ); } return; } if( IsPossibleUser( pUserWin ) ) { CItemElem itemElem; itemElem.m_dwItemId = II_CHP_RED; itemElem.m_nItemNum = GetChipNum(); if( itemElem.m_nItemNum < 1 ) itemElem.m_nItemNum = 1; itemElem.m_bCharged = itemElem.GetProp()->bCharged; itemElem.SetSerialNumber(); LogItemInfo aLogItem; aLogItem.Action = "W"; aLogItem.Gold = pUserWin->GetItemNum( II_CHP_RED ); aLogItem.Gold2 = pUserWin->GetItemNum( II_CHP_RED ) + itemElem.m_nItemNum; aLogItem.Gold_1 = itemElem.m_nItemNum; aLogItem.SendName = pUserWin->GetName(); aLogItem.WorldId = pUserWin->GetWorld()->m_dwWorldID; if( pUserWin->CreateItem( &itemElem ) ) { aLogItem.RecvName = "GUILDCOMBAT1TO1_CHIP"; if( !bDiag ) aLogItem.RecvName = "GUILDCOMBAT1TO1_G_CHIP"; } else // 지급 실패시(인벤토리가 꽉찼거나 등의 이유로...) 메일로 지급 { g_dpDBClient.SendQueryPostMail( pUserWin->m_idPlayer, 0, itemElem, 0, itemElem.GetProp()->szName, (char*)GETTEXT( TID_GAME_GUILDCOMBAT1TO1_WINCHIPPOST ) ); //pUserWin->AddDefinedText( TID_GAME_MINIGAME_ITEM_POST ); aLogItem.RecvName = "GUILDCOMBAT1TO1_CHIP_POST"; if( !bDiag ) aLogItem.RecvName = "GUILDCOMBAT1TO1_CHIP_G_POST"; } if( bDiag ) // 개인 승패만 메세지 박스 출력 { CString strTemp; strTemp.Format( prj.GetText( TID_GAME_GUILDCOMBAT_1TO1_WARWIN ), GetChipNum() ); pUserWin->AddDiagText( strTemp ); } g_DPSrvr.OnLogItem( aLogItem, &itemElem, itemElem.m_nItemNum ); } if( IsPossibleUser( pUserLost ) && bDiag ) pUserLost->AddDiagText( prj.GetText( TID_GAME_GUILDCOMBAT_1TO1_WARLOST ) ); }
void clispErrDie(void) { fehler(error,GETTEXT("Internal PARI error.")); }
static int sound_oss_play(audio_job_t aj) { /* stream stuff */ Lisp_Media_Stream *ms; media_substream *mss; /* thread stuff */ media_thread_play_state mtp; /* device stuff */ Lisp_Object device; Lisp_Audio_Device *lad = NULL; sound_oss_data_t *sod = NULL; int fd; /* buffering */ size_t len, tmplen; sxe_media_sample_t *tmpbuf; char *bptr = NULL; size_t natlen; int32_t written; int resolution, i; /* subthread stuff */ sound_oss_aj_data_t _sosd, *sosd = &_sosd; sxe_mse_volume_args _volargs, *volargs = &_volargs; sxe_mse_rerate_args _rrargs, *rrargs = &_rrargs; /* cache stuff */ int alloced_myself = 0; SOUND_UNPACK_MT(aj, device, ms, mss, lad, sod, sosd->mtap); SXE_MUTEX_LOCK(&sod->mtx); if (sod->lock) { OSS_DEBUG_HW("Device locked.\n"); message(GETTEXT("audio-oss: " "Device locked.")); /* this lock is probably unnecessary */ SXE_MUTEX_UNLOCK(&sod->mtx); return 0; } sod->lock = 1; /* okay, njsf said /dev/dsp writing is not mt safe, * also i hate OSS, so let's block everything here :) -hroptatyr */ #if defined(HAVE_THREADS) && 0 pthread_mutex_lock(&mss->substream_mutex); #endif if (sound_oss_open_device(sod) < 0) { OSS_DEBUG_HW("Opening device failed.\n"); sod->device_fd = -1; /* warning? */ message(GETTEXT("audio-oss: " "Opening OSS device failed.")); sound_oss_close_device(sod); SXE_MUTEX_UNLOCK(&sod->mtx); return 0; } /* init the sosd */ sosd->paused = sosd->volume = 0; sosd->samplerate = sosd->channels = 0; sosd->coe_ch_cnt = 0; if (sound_oss_init_device(sod, sosd) < 0) { OSS_DEBUG_HW("Device not configurable.\n"); /* warning? */ message(GETTEXT("audio-oss: " "Cannot access OSS device.")); sound_oss_close_device(sod); SXE_MUTEX_UNLOCK(&sod->mtx); return 0; } if(sosd->channels==0) { message(GETTEXT("audio-oss: " "No channels.")); sound_oss_close_device(sod); SXE_MUTEX_UNLOCK(&sod->mtx); return 0; } /* the volume effect */ ADD_MEDIA_SAMPLE_EFFECT( sosd->coe_chain, sosd->coe_ch_cnt, MEDIA_SAMPLE_EFFECT(sxe_mse_volume), volargs); volargs->num_channels = sosd->channels; /* the rerate effect */ ADD_MEDIA_SAMPLE_EFFECT( sosd->coe_chain, sosd->coe_ch_cnt, MEDIA_SAMPLE_EFFECT(sxe_mse_rerate), rrargs); rrargs->num_channels = sosd->channels; rrargs->srcrate = rrargs->tgtrate = 1; OSS_DEBUG_COE("have %d coerce functions in my chain.\n", sosd->coe_ch_cnt); XAUDIO_DEVICE_STATE(device) = ASTATE_ALIVE; SXE_MUTEX_UNLOCK(&sod->mtx); /* rewind the stream */ media_stream_meth(ms, rewind)(mss); /* play chunks of the stream */ SXE_MUTEX_LOCK(&aj->mtx); if (aj->buffer_alloc_size < SOUND_MAX_AUDIO_FRAME_SIZE) { alloced_myself = 1; aj->buffer = xmalloc_atomic(SOUND_MAX_AUDIO_FRAME_SIZE); aj->buffer_alloc_size = SOUND_MAX_AUDIO_FRAME_SIZE; } tmpbuf = (sxe_media_sample_t*)aj->buffer; resolution = (sosd->mtap->samplerate * MTPSTATE_REACT_TIME) / 1000000; fd = sod->device_fd; natlen = 0; SXE_MUTEX_UNLOCK(&aj->mtx); while (aj->play_state != MTPSTATE_STOP) { #ifdef EF_USE_ASYNEQ if (audio_job_queue(aj)) { sound_oss_handle_aj_events(aj); } #endif SXE_MUTEX_LOCK(&aj->mtx); mtp = aj->play_state; SXE_MUTEX_UNLOCK(&aj->mtx); switch (mtp) { case MTPSTATE_RUN: if (natlen > 0) goto write_buf; /* otherwise we simply fetch a new bunch of samples */ len = media_stream_meth(ms, read)( mss, aj->buffer, resolution); if (!len) { OSS_DEBUG_S("finished\n"); SXE_MUTEX_LOCK(&aj->mtx); aj->play_state = MTPSTATE_STOP; SXE_MUTEX_UNLOCK(&aj->mtx); break; } /* set up the volume args */ volargs->volume[0] = volargs->volume[1] = aj->volume; /* set up the rerate args */ rrargs->tweak = aj->ratetrafo; /* coerce the stuff */ tmplen = sosd->channels*len; for (i = 0; i < sosd->coe_ch_cnt; i++) { OSS_DEBUG_COE("calling coerce " "%d on b:0x%x l:%d\n", i, (unsigned int)tmpbuf, tmplen); tmplen = CALL_MEDIA_SAMPLE_EFFECT( sosd->coe_chain, i, tmpbuf, tmpbuf, tmplen); } /* bring back to S16 or U8 */ MEDIA_SAMPLE_FORMAT_DOWNSAMPLE(sosd->msf)( aj->buffer, aj->buffer, tmplen); /* convert tmplen back to number of frames */ natlen = tmplen * sosd->framesize / sosd->channels; bptr = aj->buffer; write_buf: OSS_DEBUG_S("remaining cruft: %d bytes\n", natlen); if ((written = write(fd, bptr, natlen)) < 0) { OSS_DEBUG_S("ERROR in write()\n"); natlen = 0; } else if (written) { natlen -= written; bptr += written; } else { natlen = 0; ioctl(fd, SNDCTL_DSP_SYNC, NULL); } break; case MTPSTATE_PAUSE: OSS_DEBUG("sleeping for %d\n", resolution); usleep(resolution); break; case MTPSTATE_UNKNOWN: case MTPSTATE_STOP: case NUMBER_OF_MEDIA_THREAD_PLAY_STATES: default: OSS_DEBUG("ACK, quit\n"); SXE_MUTEX_LOCK(&aj->mtx); aj->play_state = MTPSTATE_STOP; SXE_MUTEX_UNLOCK(&aj->mtx); break; } } /* Now cleanup all used resources */ bptr = NULL; SXE_MUTEX_LOCK(&aj->mtx); if (alloced_myself && aj->buffer) { xfree(aj->buffer); } aj->buffer = NULL; aj->buffer_alloc_size = 0; SXE_MUTEX_UNLOCK(&aj->mtx); sound_oss_close_device(sod); #if defined(HAVE_THREADS) && 0 pthread_mutex_unlock(&mss->substream_mutex); #endif return 1; }
void CWndMgr::AddAllApplet() { // 생성자 ID 타이틀 아이콘 툴팁 텍스트 AddAppletFunc( AppMain_WndNavigator , APP_NAVIGATOR , _T( "WndNavigator" ) , _T( "Icon_Navigator.dds" ) , GETTEXT( TID_TIP_NAVIGATOR ), 'N' ); AddAppletFunc( AppMain_WndStatus , APP_STATUS1 , _T( "WndStatus" ) , _T( "Icon_Status.dds" ) , GETTEXT( TID_TIP_STATUS ), 'T' ); #if __VER >= 9 // __INSERT_MAP #ifdef __IMPROVE_MAP_SYSTEM AddAppletFunc( AppMain_WndMap , APP_MAP_EX , _T( "WndMap" ) , _T( "Icon_Applet.dds" ) , GETTEXT(TID_TIP_MAP), 'M' ); #else // __IMPROVE_MAP_SYSTEM AddAppletFunc( AppMain_WndMap , APP_MAP , _T( "WndMap" ) , _T( "Icon_Applet.dds" ) , GETTEXT(TID_TIP_MAP), 'M' ); #endif // __IMPROVE_MAP_SYSTEM #endif #if __VER >= 12 // __LORD if( ::GetLanguage() == LANG_FRE ) AddAppletFunc( AppMain_LordSkill , APP_LORD_SKILL , _T( "WndLordSkill" ) , _T( "Icon_Infopang.dds" ) , GETTEXT(TID_TIP_INFOPANG), 'A' ); else AddAppletFunc( AppMain_LordSkill , APP_LORD_SKILL , _T( "WndLordSkill" ) , _T( "Icon_Infopang.dds" ) , GETTEXT(TID_TIP_INFOPANG), 'L' ); #endif // __LORD #if __VER >= 12 // __MOD_TUTORIAL AddAppletFunc( AppMain_InfoPang , APP_INFOPANG , _T( "WndInfoPang" ) , _T( "Icon_Infopang.dds" ) , GETTEXT(TID_TIP_INFOPANG), 0 ); #endif #if __VER >= 13 // __HOUSING AddAppletFunc( AppMain_Housing , APP_HOUSING , _T( "WndHousing" ) , _T( "Icon_Housing.dds" ) , GETTEXT(TID_GAME_HOUSING_BOX), 'Y' ); #endif // __HOUSING #if __VER >= 15 // __GUILD_HOUSE AddAppletFunc( AppMain_GuildHousing , APP_GH_FURNITURE_STORAGE, _T( "WndGuildHousing" ) , _T( "Icon_Housing.dds" ) , GETTEXT(TID_GAME_HOUSING_BOX), 'R' ); #endif #if __VER >= 13 // __RENEW_CHARINFO AddAppletFunc( AppMain_WndCharacter , APP_CHARACTER3 , _T( "WndCharacter" ) , _T( "Icon_Character.dds" ) , GETTEXT( TID_TIP_CHARACTER ), 'H' ); #elif __VER >= 9 // __CSC_VER9_2 AddAppletFunc( AppMain_WndCharacter , APP_CHARACTER2 , _T( "WndCharacter" ) , _T( "Icon_Character.dds" ) , GETTEXT( TID_TIP_CHARACTER ), 'H' ); #else //__CSC_VER9_2 AddAppletFunc( AppMain_WndCharacter , APP_CHARACTER , _T( "WndCharacter" ) , _T( "Icon_Character.dds" ) , GETTEXT( TID_TIP_CHARACTER ), 'H' ); #endif //__CSC_VER9_2 AddAppletFunc( AppMain_WndInventory , APP_INVENTORY , _T( "WndInventory" ) , _T( "Icon_Inventory.dds" ) , GETTEXT( TID_TIP_INVENTORY ), 'I' ); AddAppletFunc( AppMain_WndWebBox , APP_WEBBOX , _T( "WebBox" ) , _T( "Icon_CitemMall.dds" ) , GETTEXT( TID_TIP_ITEMMALL ), 0 ); #if __VER >= 10 // __CSC_VER9_1 AddAppletFunc( AppMain_WndSkill2 , APP_SKILL3 , _T( "WndSkill" ) , _T( "Icon_Skill.dds" ) , GETTEXT( TID_TIP_SKILL ), 'K' ); #else AddAppletFunc( AppMain_WndSkill2 , APP_SKILL1 , _T( "WndSkill" ) , _T( "Icon_Skill.dds" ) , GETTEXT( TID_TIP_SKILL ), 'K' ); #endif //__CSC_VER9_1 AddAppletFunc( AppMain_WndMotion , APP_MOTION , _T( "WndMotion" ) , _T( "Icon_Motion.dds" ) , GETTEXT( TID_TIP_MOTION ), 'O' ); AddAppletFunc( AppMain_WndTrade , APP_TRADE , _T( "WndTrade" ) , _T( "Icon_Trade.dds" ) , GETTEXT( TID_TIP_TRADE ), 0 ); #if __VER >= 8 // __S8_VENDOR_REVISION AddAppletFunc( AppMain_WndVendor , APP_VENDOR_REVISION , _T( "WndVendor" ) , _T( "Icon_Applet.dds" ) , GETTEXT( TID_TIP_VENDOR ), 0 ); #else // __VER >= 8 // __S8_VENDOR_REVISION AddAppletFunc( AppMain_WndVendor , APP_VENDOREX , _T( "WndVendor" ) , _T( "Icon_Applet.dds" ) , GETTEXT( TID_TIP_VENDOR ), 0 ); #endif // __VER >= 8 // __S8_VENDOR_REVISION #if __VER >= 15 // __IMPROVE_QUEST_INTERFACE AddAppletFunc( AppMain_WndQuest , APP_QUEST_EX_LIST , _T( "WndQuest" ) , _T( "Icon_Quest.dds" ) , GETTEXT( TID_TIP_QUEST ), g_Neuz.Key.chQuest ); #else // __IMPROVE_QUEST_INTERFACE AddAppletFunc( AppMain_WndQuest , APP_QUEST , _T( "WndQuest" ) , _T( "Icon_Quest.dds" ) , GETTEXT( TID_TIP_QUEST ), g_Neuz.Key.chQuest ); #endif // __IMPROVE_QUEST_INTERFACE AddAppletFunc( AppMain_WndParty , APP_PARTY , _T( "WndParty" ) , _T( "Icon_Troupe.dds" ) , GETTEXT( TID_TIP_PARTY ), 'P' ); AddAppletFunc( AppMain_WndGuild , APP_GUILD , _T( "WndGuild" ) , _T( "Icon_Troupe.dds" ) , GETTEXT( TID_TIP_COMPANY ), 'G' ); #ifdef __GUILDVOTE AddAppletFunc( AppMain_WndGuildVote , APP_GUILD_VOTE , _T( "WndGuildVote") , _T( "Icon_Troupe.dds" ) , GETTEXT( TID_TIP_COMPANY ), 'V' ); #endif #if __VER >= 11 // __SYS_POCKET #ifndef __TMP_POCKET AddAppletFunc( AppMain_BagEx , APP_BAG_EX , _T( "WndBagEx" ) , _T( "Icon_BagBag.tga" ) , GETTEXT(TID_APP_BAG_EX), 'B' ); #endif #endif AddAppletFunc( AppMain_WndCommItem , APP_COMM_ITEM , _T( "WndCommItem" ) , _T( "Icon_CItemTime.dds" ) , GETTEXT( TID_TIP_ITEMTIME ), 'J' ); AddAppletFunc( AppMain_WndUpgradeBase , APP_TEST , _T( "WndUpgradeBase" ) , _T( "Icon_Troupe.dds" ) , GETTEXT( TID_TIP_PARTY ), 0 ); AddAppletFunc( AppMain_WndPiercing , APP_PIERCING , _T( "WndPiercing" ) , _T( "Icon_Troupe.dds" ) , GETTEXT( TID_TIP_PARTY ), 0 ); AddAppletFunc( AppMain_WndChat , APP_COMMUNICATION_CHAT , _T( "WndChat" ) , _T( "Icon_Chat.dds" ) , GETTEXT( TID_TIP_COMMUNICATION_CHAT ), 0 ); AddAppletFunc( AppMain_WndMessenger , APP_MESSENGER_ , _T( "WndMessenger" ) , _T( "Icon_Messenger.dds" ) , GETTEXT( TID_TIP_MESSENGER ), 'E' ); AddAppletFunc( AppMain_WndOptSound , APP_OPTION_SOUND , _T( "WndOptSound" ) , _T( "Icon_OptSound.dds" ) , GETTEXT( TID_TIP_OPTION_SOUND ), 0 ); AddAppletFunc( AppMain_WndOptWindow , APP_OPTION_WINDOW , _T( "WndOptWindow" ) , _T( "Icon_Applet.dds" ) , GETTEXT( TID_TIP_OPTION_WINDOW ), 0 ); AddAppletFunc( AppMain_WndOptMyInfo , APP_OPTION_MYINFO , _T( "WndOptMyInfo" ) , _T( "Icon_Applet.dds" ) , GETTEXT( TID_TIP_OPTION_MYINFO ), 0 ); AddAppletFunc( AppMain_WndOption , APP_OPTIONEX , _T( "WndOption" ) , _T( "Icon_Applet.dds" ) , GETTEXT( TID_APP_OPTION ), 0 ); AddAppletFunc( AppMain_WndInfoNotice , APP_INFO_NOTICE , _T( "WndInfoNotice" ) , _T( "Icon_Applet.dds" ) , GETTEXT( TID_TIP_INFO_NOTICE ), 0 ); //AddAppletFunc( AppMain_WndVIP , APP_INFO_VIP , _T( "WndVIP" ) , _T( "Icon_Applet.dds" ) , GETTEXT( TID_TIP_INFO_NOTICE ), 'V' ); AddAppletFunc( AppMain_WndHelpHelp , APP_HELPER_HELP , _T( "WndHelpHelp" ) , _T( "Icon_HelperHelp.dds" ) , GETTEXT( TID_TIP_HELPER_HELP ), 0 ); AddAppletFunc( AppMain_WndHelpTip , APP_HELPER_TIP , _T( "WndHelpTip" ) , _T( "Icon_HelperTip.dds" ) , GETTEXT( TID_TIP_HELPER_TIP ), 0 ); AddAppletFunc( AppMain_WndHelpFAQ , APP_HELPER_FAQ , _T( "WndHelpFAQ" ) , _T( "Icon_HelperFAQ.dds" ) , GETTEXT( TID_TIP_HELPER_FAQ ), 0 ); AddAppletFunc( AppMain_WndLogOut , APP_LOGOUT , _T( "WndLogout" ) , _T( "Icon_Logout.dds" ) , GETTEXT( TID_TIP_LOGOUT ), 0 ); AddAppletFunc( AppMain_WndQuit , APP_QUIT , _T( "WndQuit" ) , _T( "Icon_Quit.dds" ) , GETTEXT( TID_TIP_QUIT ), 0 ); // if( GetLanguage() == LANG_TWN ) AddAppletFunc( AppMain_WndWebBox2 , APP_WEBBOX2 , _T( "WebBox2" ) , _T( "QOODO.dds" ) , GETTEXT( TID_TIP_QOODO ), 0 ); AddAppletFunc( AppMain_WndWorld , APP_WORLD , _T( "WndWorld" ) , _T( "Icon_Applet.dds" ) , GETTEXT( TID_TIP_WORLD ), 0 ); AddAppletFunc( AppMain_WndDebugInfo , APP_DEBUGINFO , _T( "WndDebugInfo" ) , _T( "Icon_Applet.dds" ) , GETTEXT( TID_TIP_DEBUGINFO ), 0 ); AddAppletFunc( AppMain_WndLogin , APP_LOGIN , _T( "WndLogin" ) , _T( "Icon_Login.dds" ) , GETTEXT( TID_TIP_APPLET ), 0 ); AddAppletFunc( AppMain_WndSelectServer , APP_SELECT_SERVER , _T( "WndSelectServer") , _T( "Icon_SelectServer.dds") , GETTEXT( TID_TIP_WORLD ), 0 ); AddAppletFunc( AppMain_WndCreateChar , APP_CREATE_CHAR , _T( "WndCreateChar" ) , _T( "Icon_CreateChar.dds" ) , GETTEXT( TID_TIP_WORLD ), 0 ); AddAppletFunc( AppMain_WndSelectChar , APP_SELECT_CHAR , _T( "WndSelectChar" ) , _T( "Icon_SelectChar.dds" ) , GETTEXT( TID_TIP_DIALOG ), 0 ); #if __VER >= 8 //__CSC_VER8_2 AddAppletFunc( AppMain_WndPartyQuick , APP_PARTY_QUICK , _T( "WndPartyQuick" ) , NULL , GETTEXT( TID_TIP_DIALOG ), 0 ); #endif //__CSC_VER8_2 #if __VER >= 8 //__CSC_VER8_3 AddAppletFunc( AppMain_WndBuffStatus , APP_BUFF_STATUS , _T( "WndBuffStatus" ) , NULL , GETTEXT( TID_TIP_DIALOG ), 0 ); #endif //__CSC_VER8_3 #if __VER >= 13 // __CSC_VER13_2 if( ::GetLanguage() == LANG_FRE ) AddAppletFunc( AppMain_Couple , APP_COUPLE_MAIN , _T( "WndCoupleManager" ) , _T( "Icon_Couple.dds" ) , GETTEXT( TID_GAME_COUPLE ), 'X' ); else AddAppletFunc( AppMain_Couple , APP_COUPLE_MAIN , _T( "WndCoupleManager" ) , _T( "Icon_Couple.dds" ) , GETTEXT( TID_GAME_COUPLE ), 'F' ); #endif //__CSC_VER13_2 #if __VER >= 15 // __2ND_PASSWORD_SYSTEM AddAppletFunc( AppMain_Wnd2ndPassword , APP_2ND_PASSWORD_NUMBERPAD , _T( "Wnd2ndPassword" ) , _T( "Icon_Applet.dds" ) , GETTEXT( TID_2ND_PASSWORD_WINDOW_OPEN ), 0 ); #endif // __2ND_PASSWORD_SYSTEM #ifdef __NEW_WEB_BOX AddAppletFunc( AppMain_WndHelperWebBox , APP_WEBBOX2 , _T( "HelperWebBox" ) , _T( "Icon_HelperHelp.dds" ) , GETTEXT( TID_GAME_HELPER_WEB_BOX_ICON_TOOLTIP ), 0 ); #endif // __NEW_WEB_BOX }
/* bring back to S16 or U8 */ MEDIA_SAMPLE_FORMAT_DOWNSAMPLE(sasd->msf)( aj->buffer, aj->buffer, tmplen); ao_play(sasd->dev, aj->buffer, tmplen * sasd->framesize / sasd->mtap->channels); return tmplen; } #ifdef EF_USE_ASYNEQ static inline void sound_ao_change_volume(audio_job_t aj, audio_job_event_args_t args) { SXE_MUTEX_LOCK(&aj->mtx); aj->volume = args->volume_args; SXE_MUTEX_UNLOCK(&aj->mtx); } static inline void sound_ao_change_rate(audio_job_t aj, audio_job_event_args_t args) { SXE_MUTEX_LOCK(&aj->mtx); aj->ratetrafo = args->rate_args; SXE_MUTEX_UNLOCK(&aj->mtx); } static inline void sound_ao_change_state(audio_job_t aj, audio_job_event_args_t args) { SXE_MUTEX_LOCK(&aj->mtx); switch (args->state_args) { case aj_pause: AO_DEBUG_AJ("->pause state\n"); aj->play_state = MTPSTATE_PAUSE; break; case aj_resume: AO_DEBUG_AJ("->resume state\n"); aj->play_state = MTPSTATE_RUN; break; case aj_start: AO_DEBUG_AJ("->start state\n"); break; case aj_stop: AO_DEBUG_AJ("->stop state\n"); aj->play_state = MTPSTATE_STOP; break; case no_audio_job_change_states: default: AO_DEBUG_AJ("->unknown state\n"); break; } SXE_MUTEX_UNLOCK(&aj->mtx); } static inline void sound_ao_handle_aj_events(audio_job_t aj) __attribute__((always_inline)); static inline void sound_ao_handle_aj_events(audio_job_t aj) { sound_ao_aj_data_t *sasd; audio_job_event_t ev = NULL; #if 0 assert(audio_job_queue(aj)); #endif SXE_MUTEX_LOCK(&aj->mtx); sasd = audio_job_device_data(aj); if ((ev = eq_noseeum_dequeue(audio_job_queue(aj))) == NULL) { SXE_MUTEX_UNLOCK(&aj->mtx); return; } SXE_MUTEX_UNLOCK(&aj->mtx); AO_DEBUG_AJ("Event 0x%lx\n", (long unsigned int)ev); switch (audio_job_event_kind(ev)) { case aj_change_state: AO_DEBUG_AJ("change state event\n"); sound_ao_change_state(aj, &audio_job_event_args(ev)); break; case aj_change_volume: AO_DEBUG_AJ("change volume event\n"); sound_ao_change_volume(aj, &audio_job_event_args(ev)); break; case aj_change_rate: AO_DEBUG_AJ("change rate event\n"); sound_ao_change_rate(aj, &audio_job_event_args(ev)); break; case no_audio_job_event_kinds: default: AO_CRITICAL("unknown event\n"); break; } free_audio_job_event(ev); } #endif /* EF_USE_ASYNEQ */ static int sound_ao_play(audio_job_t aj) { /* stream stuff */ Lisp_Media_Stream *ms; media_substream *mss; /* thread stuff */ media_thread_play_state mtp; /* device stuff */ Lisp_Object device; Lisp_Audio_Device *lad = NULL; sound_ao_data_t *saod = NULL; /* libao stuff */ ao_sample_format *format; ao_option *options; int driver; /* buffering */ int resolution; /* subthread stuff */ sound_ao_aj_data_t _sasd, *sasd = &_sasd; sxe_mse_volume_args _volargs, *volargs = &_volargs; sxe_mse_rerate_args _rrargs, *rrargs = &_rrargs; /* cache stuff */ int alloced_myself = 0; SOUND_UNPACK_MT(aj, device, ms, mss, lad, saod, sasd->mtap); /* setup for the driver */ driver = saod->driver_id; format = saod->fmt; options = saod->options; /* setup format specs from audio props */ format->channels = sasd->mtap->channels; format->rate = sasd->mtap->samplerate; format->bits = 16; /* HARDCODED, was: mtap->samplewidth; */ format->byte_format = AO_FMT_LITTLE; /* hmpf */ /* open the driver */ sasd->dev = ao_open_live(driver, format, options); if (sasd->dev == NULL) { message(GETTEXT("audio: Unsupported device.")); XAUDIO_DEVICE_STATE(device) = ASTATE_DEAD; return 0; } /* fill the subthread data structure */ sasd->msf = MEDIA_SAMPLE_FORMAT(sxe_msf_S16); sasd->framesize = sasd->mtap->channels * sizeof(int16_t); sasd->coe_ch_cnt = 0; audio_job_device_data(aj) = sasd; /* the volume effect */ ADD_MEDIA_SAMPLE_EFFECT( sasd->coe_chain, sasd->coe_ch_cnt, MEDIA_SAMPLE_EFFECT(sxe_mse_volume), volargs); volargs->num_channels = sasd->mtap->channels; sasd->volargs = volargs; /* the rerate effect */ ADD_MEDIA_SAMPLE_EFFECT( sasd->coe_chain, sasd->coe_ch_cnt, MEDIA_SAMPLE_EFFECT(sxe_mse_rerate), rrargs); rrargs->num_channels = sasd->mtap->channels; rrargs->srcrate = rrargs->tgtrate = 1; sasd->rrargs = rrargs; /* rewind it ... */ media_stream_meth(ms, rewind)(mss); XAUDIO_DEVICE_STATE(device) = ASTATE_ALIVE; /* ... and play it */ SXE_MUTEX_LOCK(&aj->mtx); mtp = aj->play_state; if (aj->buffer_alloc_size < SOUND_MAX_AUDIO_FRAME_SIZE) { alloced_myself = 1; aj->buffer = xmalloc_atomic(SOUND_MAX_AUDIO_FRAME_SIZE); aj->buffer_alloc_size = SOUND_MAX_AUDIO_FRAME_SIZE; } SXE_MUTEX_UNLOCK(&aj->mtx); resolution = (sasd->mtap->samplerate * MTPSTATE_REACT_TIME) / 1000000; while (mtp != MTPSTATE_STOP) { #ifdef EF_USE_ASYNEQ /* events are there? */ if (audio_job_queue(aj)) { sound_ao_handle_aj_events(aj); } #endif SXE_MUTEX_LOCK(&aj->mtx); switch (aj->play_state) { case MTPSTATE_RUN: if (!ao_push(aj, resolution)) aj->play_state = MTPSTATE_STOP; break; case MTPSTATE_PAUSE: /* must sleep resolution outside of lock */ case MTPSTATE_UNKNOWN: case MTPSTATE_STOP: case NUMBER_OF_MEDIA_THREAD_PLAY_STATES: default: AO_DEBUG("ACK, quit\n"); aj->play_state = MTPSTATE_STOP; break; } mtp = aj->play_state; SXE_MUTEX_UNLOCK(&aj->mtx); if (mtp == MTPSTATE_PAUSE) { AO_DEBUG("sleeping for %d\n", resolution); usleep(resolution); break; } } /* -- Close and shutdown -- */ SXE_MUTEX_LOCK(&aj->mtx); if (alloced_myself && aj->buffer) { xfree(aj->buffer); } aj->buffer = NULL; aj->buffer_alloc_size = 0; SXE_MUTEX_UNLOCK(&aj->mtx); /* sasd is always != NULL here per its initialization */ if (sasd->dev) { ao_close(sasd->dev); sasd->dev = NULL; } sasd = NULL; return 1; }