From 1ed2c76ecb3f7351b9194356623bbad2f1313aa8 Mon Sep 17 00:00:00 2001 From: s_alexander Date: Mon, 29 Jun 2009 01:02:40 +0000 Subject: merged svn trunk r1837 into cmake branche git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@1838 b956fd51-792f-4845-bead-9b4dfca2ff2c --- cmake/BuildBot.trigger | 1 + cmake/COPYRIGHT.txt | 1 + cmake/DisplayChanges.patch | 88 + cmake/game/languages/Catalan.ini | 377 +++++ cmake/game/languages/Croatian.ini | 60 + cmake/game/languages/Dutch.ini | 60 + cmake/game/languages/English.ini | 60 + cmake/game/languages/Euskara.ini | 60 + cmake/game/languages/Finnish.ini | 60 + cmake/game/languages/French.ini | 60 + cmake/game/languages/German.ini | 60 + cmake/game/languages/Greek.ini | 60 + cmake/game/languages/Italian.ini | 60 + cmake/game/languages/Portuguese.ini | 60 + cmake/game/languages/Spanish.ini | 60 + cmake/game/languages/Swedish.ini | 60 + cmake/game/themes/Classic.ini | 17 +- cmake/game/themes/Deluxe.ini | 19 +- cmake/game/themes/Deluxe/Blue.ini | 20 +- cmake/game/themes/Deluxe/Fall.ini | 46 +- cmake/game/themes/Deluxe/Ocean.ini | 230 +++ cmake/game/themes/Deluxe/Ribbon.ini | 50 +- cmake/game/themes/Deluxe/Summer.ini | 46 +- cmake/game/themes/Deluxe/Winter.ini | 45 +- cmake/game/themes/Deluxe/[main]selectbg.png | Bin 260 -> 2969 bytes cmake/game/themes/Deluxe/interface/cursor.png | Bin 0 -> 4111 bytes .../themes/Deluxe/interface/cursor_pressed.png | Bin 0 -> 3756 bytes .../themes/Deluxe/interface/select_arrow_left.png | Bin 0 -> 485 bytes .../themes/Deluxe/interface/select_arrow_right.png | Bin 0 -> 485 bytes cmake/plugins/Blind/Blind.dpr | 2 +- cmake/plugins/Dont_Get_Worse/Hold_The_Line.dpr | 23 +- cmake/plugins/README(Plugins Status).txt | 3 + cmake/plugins/SDK/ModiSDK.pas | 26 +- cmake/plugins/Team_Duell/TeamDuell.dpr | 29 +- cmake/src/base/UBeatTimer.pas | 170 ++ cmake/src/base/UCommon.pas | 98 +- cmake/src/base/UDraw.pas | 2 +- cmake/src/base/UGraphic.pas | 34 +- cmake/src/base/UImage.pas | 41 +- cmake/src/base/UIni.pas | 262 ++- cmake/src/base/UMain.pas | 81 +- cmake/src/base/UMusic.pas | 134 +- cmake/src/base/USingScores.pas | 643 ++++---- cmake/src/base/UTexture.pas | 4 +- cmake/src/base/UThemes.pas | 33 +- cmake/src/base/UTime.pas | 28 +- cmake/src/lib/ffmpeg/avcodec.pas | 1706 +++++++++++++++----- cmake/src/lib/ffmpeg/avformat.pas | 288 +++- cmake/src/lib/ffmpeg/avio.pas | 43 +- cmake/src/lib/ffmpeg/avutil.pas | 183 ++- cmake/src/lib/ffmpeg/mathematics.pas | 14 +- cmake/src/lib/ffmpeg/opt.pas | 16 +- cmake/src/lib/ffmpeg/rational.pas | 11 +- cmake/src/lib/ffmpeg/swscale.pas | 160 +- cmake/src/media/UAudioDecoder_FFmpeg.pas | 10 +- cmake/src/media/UVideo.pas | 6 + cmake/src/menu/UDisplay.pas | 218 ++- cmake/src/menu/UMenu.pas | 302 +++- cmake/src/menu/UMenuButton.pas | 74 +- cmake/src/menu/UMenuSelectSlide.pas | 192 ++- cmake/src/menu/UMenuText.pas | 167 +- cmake/src/screens/UScreenEditConvert.pas | 43 +- cmake/src/screens/UScreenMain.pas | 34 +- cmake/src/screens/UScreenOptionsAdvanced.pas | 31 +- cmake/src/screens/UScreenOptionsGame.pas | 50 +- cmake/src/screens/UScreenOptionsGraphics.pas | 25 +- cmake/src/screens/UScreenOptionsLyrics.pas | 15 +- cmake/src/screens/UScreenOptionsRecord.pas | 5 + cmake/src/screens/UScreenOptionsSound.pas | 42 +- cmake/src/screens/UScreenOptionsThemes.pas | 8 +- cmake/src/screens/UScreenScore.pas | 10 + cmake/src/screens/UScreenSing.pas | 14 +- cmake/src/screens/UScreenSong.pas | 140 +- cmake/src/screens/UScreenTop5.pas | 35 +- cmake/src/ultrastardx.dpr | 1 + cmake/test/test001.pas | 86 + 76 files changed, 5522 insertions(+), 1680 deletions(-) create mode 100644 cmake/BuildBot.trigger create mode 100644 cmake/DisplayChanges.patch create mode 100644 cmake/game/languages/Catalan.ini create mode 100644 cmake/game/themes/Deluxe/Ocean.ini create mode 100644 cmake/game/themes/Deluxe/interface/cursor.png create mode 100644 cmake/game/themes/Deluxe/interface/cursor_pressed.png create mode 100644 cmake/game/themes/Deluxe/interface/select_arrow_left.png create mode 100644 cmake/game/themes/Deluxe/interface/select_arrow_right.png create mode 100644 cmake/src/base/UBeatTimer.pas create mode 100644 cmake/test/test001.pas (limited to 'cmake') diff --git a/cmake/BuildBot.trigger b/cmake/BuildBot.trigger new file mode 100644 index 00000000..56a6051c --- /dev/null +++ b/cmake/BuildBot.trigger @@ -0,0 +1 @@ +1 \ No newline at end of file diff --git a/cmake/COPYRIGHT.txt b/cmake/COPYRIGHT.txt index aea7fee0..2dbd2616 100644 --- a/cmake/COPYRIGHT.txt +++ b/cmake/COPYRIGHT.txt @@ -25,4 +25,5 @@ Patches contributed by: "jekatt" Benedikt Krueger Holger Kuhn "hawkear" +Florian Küpper "flokuep" Wesley Stessens "profoX" \ No newline at end of file diff --git a/cmake/DisplayChanges.patch b/cmake/DisplayChanges.patch new file mode 100644 index 00000000..c22be897 --- /dev/null +++ b/cmake/DisplayChanges.patch @@ -0,0 +1,88 @@ +Index: src/menu/UDisplay.pas +=================================================================== +--- src/menu/UDisplay.pas (revision 1702) ++++ src/menu/UDisplay.pas (working copy) +@@ -42,8 +42,65 @@ + SysUtils; + + type ++ { this is a effect for screen fade that in fact does nothing ++ and should be used as parent for new fade effect. ++ It will also be used if fading is disabled } ++ TFadeEffect = class ++ private ++ ++ public ++ constructor Create; ++ ++ { this procedure is called when a screen change starts } ++ procedure StartFade; ++ ++ { this function is called during a screen change, before screen ++ is drawn. screenchange is finished if this function returns ++ true. DoFadePostDraw will be called in every case after this ++ function was called, but fading will be finished regardless ++ what is returned DoFadePostDraw.} ++ function DoFadePreDraw: Boolean; ++ ++ { this function is called during a screen change, after screen ++ was drawn. screenchange is finished if this function returns ++ true. } ++ function DoFadePostDraw: Boolean; ++ ++ ++ ++ destructor Destroy; ++ end; ++ ++ { class representing a kind of screen that is drawn over ++ one or more other screens. it has focus before the ++ screens that it is overlaying } ++ TOverlay = class(TMenu); ++ + TDisplay = class + private ++ FadeInProgress: Boolean; ++ CurrentMenu: TMenu; ++ ++ FadeEffect: TFadeEffect; ++ public ++ constructor Create(Caption: String); ++ ++ { changes displayed screen, starts fading } ++ procedure ChangeMenu(NewScreen: TMenu); ++ property Menu: TMenu read CurrentMenu write ChangeMenu; ++ ++ ++ ++ ++ ++ { calls draw procedures of Screen and overlays, it ++ returns false if application should be closed } ++ function Draw: Boolean; ++ ++ destructor Destroy; ++ ++ {TDisplay = class ++ private + //fade-to-black-hack + BlackScreen: boolean; + +@@ -53,7 +110,7 @@ + LastFadeTime: cardinal; // last fade update time + + FadeTex: array[1..2] of GLuint; +- ++ + FPSCounter: cardinal; + LastFPS: cardinal; + NextFPSSwap: cardinal; +@@ -78,7 +135,7 @@ + procedure SaveScreenShot; + + function Draw: boolean; +- end; ++ end; } + + var + Display: TDisplay; diff --git a/cmake/game/languages/Catalan.ini b/cmake/game/languages/Catalan.ini new file mode 100644 index 00000000..5e3c0a5c --- /dev/null +++ b/cmake/game/languages/Catalan.ini @@ -0,0 +1,377 @@ +[Text] +OPTION_VALUE_EASY=Easy +OPTION_VALUE_MEDIUM=Medium +OPTION_VALUE_HARD=Hard + +OPTION_VALUE_ON=On +OPTION_VALUE_OFF=Off + +OPTION_VALUE_EDITION=Edition +OPTION_VALUE_GENRE=Genre +OPTION_VALUE_LANGUAGE=Language +OPTION_VALUE_FOLDER=Folder +OPTION_VALUE_TITLE=Title +OPTION_VALUE_ARTIST=Artist +OPTION_VALUE_TITLE2=Title2 +OPTION_VALUE_ARTIST2=Artist2 + +OPTION_VALUE_WHENNOVIDEO=When No Video + +OPTION_VALUE_SMALL=Small +OPTION_VALUE_BIG=Big + +OPTION_VALUE_HALF=Half +OPTION_VALUE_FULL_VID=Full (Video) +OPTION_VALUE_FULL_VID_BG=Full (BG & Video) + +OPTION_VALUE_AUTO=Auto +OPTION_VALUE_SEC=Second +OPTION_VALUE_SECS=Seconds + +OPTION_VALUE_PLAIN=Plain +OPTION_VALUE_OLINE1=OLine1 +OPTION_VALUE_OLINE2=OLine2 + +OPTION_VALUE_SIMPLE=Simple +OPTION_VALUE_ZOOM=Zoom +OPTION_VALUE_SLIDE=Slide +OPTION_VALUE_BALL=Ball +OPTION_VALUE_SHIFT=Shift + +OPTION_VALUE_EURO=Euro +OPTION_VALUE_JAPAN=Japan +OPTION_VALUE_AMERICAN=American + +OPTION_VALUE_BLUE=Blue +OPTION_VALUE_GREEN=Green +OPTION_VALUE_PINK=Pink +OPTION_VALUE_RED=Red +OPTION_VALUE_VIOLET=Violet +OPTION_VALUE_ORANGE=Orange +OPTION_VALUE_YELLOW=Yellow +OPTION_VALUE_BROWN=Brown +OPTION_VALUE_BALCK=Black + +OPTION_VALUE_SING=Sing +OPTION_VALUE_SELECT_PLAYERS=Select Players +OPTION_VALUE_OPEN_MENU=Open Menu + +OPTION_VALUE_HARDWARE_CURSOR=Hardware Cursor +OPTION_VALUE_SOFTWARE_CURSOR=Software Cursor + +SING_LOADING=Carregant... + +SING_CHOOSE_MODE=Triar mode +SING_SING=cantar +SING_SING_DESC=joc ràpid: cantar un solo o un duet + +SING_MULTI=festa +SING_MULTI_DESC=cantar en mode festa + +SING_TOOLS=eines + +SING_STATS=estadístiques +SING_STATS_DESC=veure estadístiques + +SING_EDITOR=editor +SING_EDITOR_DESC=crea les teves propies cançons + +SING_GAME_OPTIONS=opcions de joc +SING_GAME_OPTIONS_DESC=canviar preferències de joc + +SING_EXIT=sortir +SING_EXIT_DESC=sortir del joc + +SING_OPTIONS=opcions +SING_OPTIONS_DESC=canviar preferències +SING_OPTIONS_WHEREAMI=Opcions + +SING_OPTIONS_GAME=joc +SING_OPTIONS_GRAPHICS=gràfics +SING_OPTIONS_SOUND=so +SING_OPTIONS_LYRICS=lletres +SING_OPTIONS_THEMES=aparença +SING_OPTIONS_RECORD=gravar +SING_OPTIONS_ADVANCED=avançat +SING_OPTIONS_EXIT=enrere + +SING_OPTIONS_GAME_WHEREAMI=Opcions de joc +SING_OPTIONS_GAME_DESC=opcions generals del joc +SING_OPTIONS_GAME_PLAYERS=Jugadors +SING_OPTIONS_GAME_DIFFICULTY=Dificultat +SING_OPTIONS_GAME_LANGUAGE=Idioma +SING_OPTIONS_GAME_TABS=Pestanyes +SING_OPTIONS_GAME_SORTING=Ordenació +SING_OPTIONS_GAME_DEBUG=Debug + +SING_OPTIONS_GRAPHICS_WHEREAMI=Opcions Gràfiques +SING_OPTIONS_GRAPHICS_DESC=configurar gràfics +SING_OPTIONS_GRAPHICS_RESOLUTION=ResoluciÌ£ +SING_OPTIONS_GRAPHICS_FULLSCREEN=Pantalla complerta +SING_OPTIONS_GRAPHICS_DEPTH=Profunditat +SING_OPTIONS_GRAPHICS_VISUALIZER=Visualització +SING_OPTIONS_GRAPHICS_OSCILLOSCOPE=Oscil·loscopi +SING_OPTIONS_GRAPHICS_LINEBONUS=Bonus de línia +SING_OPTIONS_GRAPHICS_MOVIE_SIZE=Mida pel·lícula + +SING_OPTIONS_SOUND_WHEREAMI=Opcions de so +SING_OPTIONS_SOUND_DESC=configurar so +SING_OPTIONS_SOUND_VOICEPASSTHROUGH=Reproducció del micro +SING_OPTIONS_SOUND_BACKGROUNDMUSIC=Música de fons +SING_OPTIONS_SOUND_MIC_BOOST=Ampli Micro +SING_OPTIONS_SOUND_CLICK_ASSIST=Assistència Click +SING_OPTIONS_SOUND_BEAT_CLICK=Clic de ritme +SING_OPTIONS_SOUND_THRESHOLD=Llindar +SING_OPTIONS_SOUND_TWO_PLAYERS_MODE=Mode dos jugadors +SING_OPTIONS_SOUND_PREVIEWVOLUME=Volum previsualitzar +SING_OPTIONS_SOUND_PREVIEWFADING=Fos previsualitzar + +SING_OPTIONS_LYRICS_WHEREAMI=Opcions Lletra +SING_OPTIONS_LYRICS_DESC=configuració de lletres +SING_OPTIONS_LYRICS_FONT=Font +SING_OPTIONS_LYRICS_EFFECT=Efecte +SING_OPTIONS_LYRICS_SOLMIZATION=Solfeig +SING_OPTIONS_LYRICS_NOTELINES=Pentagrama + +SING_OPTIONS_THEMES_WHEREAMI=Options d'Aparença +SING_OPTIONS_THEMES_DESC=Configuració d'aparença +SING_OPTIONS_THEMES_THEME=Aparença +SING_OPTIONS_THEMES_SKIN=Pell +SING_OPTIONS_THEMES_COLOR=Color + +SING_OPTIONS_RECORD_WHEREAMI=Opcions de micro +SING_OPTIONS_RECORD_DESC=configuració del micro +SING_OPTIONS_RECORD_CARD=Tarjeta de so +SING_OPTIONS_RECORD_INPUT=Entrada +SING_OPTIONS_RECORD_CHANNEL=Canal + +SING_OPTIONS_ADVANCED_WHEREAMI=Opcions Avançades +SING_OPTIONS_ADVANCED_DESC=opcions avançades +SING_OPTIONS_ADVANCED_EFFECTSING=Efectes de cantar +SING_OPTIONS_ADVANCED_SCREENFADE=Fos de pantalla +SING_OPTIONS_ADVANCED_LOADANIMATION=Animació càrrega +SING_OPTIONS_ADVANCED_ASKBEFOREDEL=Prequnta abans d'esborrar +SING_OPTIONS_ADVANCED_LINEBONUS=Bonus de línia +SING_OPTIONS_ADVANCED_COUNT_HOW_OFTEN_SUNG=Quantes vegades cantada +SING_OPTIONS_ADVANCED_ONSONGCLICK=després de triar cançó +SING_OPTIONS_ADVANCED_PARTYPOPUP=Menú Automàtic de festa +SING_EDIT=Editor +SING_EDIT_MENU_DESCRIPTION=crea cançons +SING_EDIT_BUTTON_DESCRIPTION_CONVERT=Importar text de fitxer midi +SING_EDIT_BUTTON_DESCRIPTION_EXIT=tornar +SING_EDIT_BUTTON_CONVERT=Importar +SING_EDIT_BUTTON_EXIT=enrere +SING_EDIT_NAVIGATE=navegar +SING_EDIT_SELECT=triar +SING_EDIT_EXIT=enrere + + +SING_LEGEND_SELECT=seleccionar +SING_LEGEND_NAVIGATE=navegar +SING_LEGEND_CONTINUE=continuar +SING_LEGEND_ESC=enrere + +SING_PLAYER_DESC=entrar nom de jugador/s +SING_PLAYER_WHEREAMI=Nom dels jugadors +SING_PLAYER_ENTER_NAME=introduir nom + +SING_DIFFICULTY_DESC=triar dificultat +SING_DIFFICULTY_WHEREAMI=Dificultat +SING_DIFFICULTY_CONTINUE=a selecció de cançó +SING_EASY=Fàcil +SING_MEDIUM=Mitjà +SING_HARD=Difícil + +SING_SONG_SELECTION_DESC=triar cançó +SING_SONG_SELECTION_WHEREAMI=Selecció de cançons +SING_SONG_SELECTION_GOTO=Anar a .. +SING_SONG_SELECTION=selecció de cançons +SING_SONG_SELECTION_MENU=menú +SING_SONG_SELECTION_PLAYLIST=llista +SING_SONGS_IN_CAT=Cançons +PLAYLIST_CATTEXT=Playlist: %s + +SING_TIME=TEMPS +SING_TOTAL=total +SING_MODE=cantar sol +SING_NOTES=notes +SING_GOLDEN_NOTES=notes daurades +SING_PHRASE_BONUS=bonus de línia + +SING_MENU=Menú principal + +SONG_SCORE=puntuació cançó +SONG_SCORE_WHEREAMI=Puntuació + +SING_SCORE_TONE_DEAF=Sense oïda +SING_SCORE_AMATEUR=Novell +SING_SCORE_WANNABE=Aficionat +SING_SCORE_HOPEFUL=Esperançador +SING_SCORE_RISING_STAR=Futura estrella +SING_SCORE_LEAD_SINGER=Bon cantant +SING_SCORE_SUPERSTAR=Estrella +SING_SCORE_ULTRASTAR=Super estrella + +SING_TOP_5_CHARTS=millors 5 jugadors +SING_TOP_5_CHARTS_WHEREAMI=millors 5 +SING_TOP_5_CHARTS_CONTINUE=a selecció de cançó + +POPUP_PERFECT=perfecte! +POPUP_AWESOME=genial! +POPUP_GREAT=molt bo! +POPUP_GOOD=esta bé! +POPUP_NOTBAD=pots millorar! +POPUP_BAD=malament! +POPUP_POOR=pobre! +POPUP_AWFUL=boo fora! + +IMPLODE_GLUE1=, +IMPLODE_GLUE2= i + +SONG_MENU_NAME_MAIN=menú de cançons +SONG_MENU_PLAY=Cantar +SONG_MENU_CHANGEPLAYERS=Canviar jugadors +SONG_MENU_EDIT=Editar +SONG_MENU_MODI=Cantar un Modi +SONG_MENU_CANCEL=Cancel·lar + +SONG_MENU_NAME_PLAYLIST=Menú de cançons +SONG_MENU_PLAYLIST_ADD=Afegir Cançó +SONG_MENU_PLAYLIST_DEL=Esborrar Cançó + +SONG_MENU_NAME_PLAYLIST_ADD=Afegir Song +SONG_MENU_PLAYLIST_ADD_NEW=a nova llista +SONG_MENU_PLAYLIST_ADD_EXISTING=a llista existent +SONG_MENU_PLAYLIST_NOEXISTING=No hi ha llistes + +SONG_MENU_NAME_PLAYLIST_NEW=Nova llista +SONG_MENU_PLAYLIST_NEW_CREATE=Crear +SONG_MENU_PLAYLIST_NEW_UNNAMED=Sense nom + +SONG_MENU_NAME_PLAYLIST_DELITEM=Segur que vols esborrar? +SONG_MENU_YES=Si +SONG_MENU_NO=No + +SONG_MENU_NAME_PLAYLIST_LOAD=Obrir llista +SONG_MENU_PLAYLIST_LOAD=obrir +SONG_MENU_PLAYLIST_DELCURRENT=esborrar llista + +SONG_MENU_NAME_PLAYLIST_DEL=Esborrar llista? + +SONG_MENU_NAME_PARTY_MAIN=Menú festa +SONG_MENU_JOKER=Comodí + +SONG_MENU_NAME_PARTY_JOKER=utilitzar comodí + +SONG_JUMPTO_DESC=buscar cançó +SONG_JUMPTO_TYPE_DESC=Buscar: +SONG_JUMPTO_TYPE1=Tot +SONG_JUMPTO_TYPE2=Títol +SONG_JUMPTO_TYPE3=Artista +SONG_JUMPTO_SONGSFOUND=%d Cançons trobades +SONG_JUMPTO_NOSONGSFOUND=No s'han trobat cançons +SONG_JUMPTO_HELP=Introduir text a cercar +SONG_JUMPTO_CATTEXT=Cercant: %s + +PARTY_MODE=mode festa +PARTY_DIFFICULTY=Dificultat +PARTY_PLAYLIST=Mode llista +PARTY_PLAYLIST_ALL=Tot +PARTY_PLAYLIST_CATEGORY=Directori +PARTY_PLAYLIST_PLAYLIST=llista +PARTY_ROUNDS=Rondes +PARTY_TEAMS=Equips +PARTY_TEAMS_PLAYER1=Player Team1 +PARTY_TEAMS_PLAYER2=Player Team2 +PARTY_TEAMS_PLAYER3=Player Team3 + +PARTY_LEGEND_CONTINUE=continuar + +PARTY_OPTIONS_DESC=opcions mode festa +PARTY_OPTIONS_WHEREAMI=Opcions Festa + +PARTY_PLAYER_DESC=introduïr noms de jugadors i equips +PARTY_PLAYER_WHEREAMI=Noms +PARTY_PLAYER_ENTER_NAME=introduïr noms +PARTY_PLAYER_LEGEND_CONTINUE=iniciar festa + +PARTY_ROUND_DESC=següent jugador al micro +PARTY_ROUND_WHEREAMI=Següent Ronda +PARTY_ROUND_LEGEND_CONTINUE=iniciar ronda + +PARTY_SONG_WHEREAMI=Selecció de cançó mode festa +PARTY_SONG_LEGEND_CONTINUE=cantar +PARTY_SONG_MENU=menú festa + +PARTY_SCORE_DESC=puntuació de l'última ronda +PARTY_SCORE_WHEREAMI=Punts mode festa + +PARTY_WIN_DESC=guanyador de la festa +PARTY_WIN_WHEREAMI=Guanyador +PARTY_WIN_LEGEND_CONTINUE=tornar al menú principal + +PARTY_ROUND=Ronda +PARTY_ROUND_WINNER=Guanyador +PARTY_NOTPLAYEDYET=no s'ha jugat encara +PARTY_NOBODY=ningú +NEXT_ROUND=Següent ronda: + +PARTY_DISMISSED=Abandona! +PARTY_SCORE_WINS=%s +PARTY_SCORE_WINS2=guanya! + +PLUGIN_HDL_NAME=Aguantar la línia +PLUGIN_HDL_DESC=No baixis de la fletxa a la barra de qualitat + +PLUGIN_UNTIL5000_NAME=Fins a 5000 +PLUGIN_UNTIL5000_DESC=El primer a arribar a 5000 punts guanya + +PLUGIN_DUELL_NAME=Duel +PLUGIN_DUELL_DESC=Cantar un duela fins a 10000 punts + +PLUGIN_BLIND_NAME=Mode cec +PLUGIN_BLIND_DESC=Duel sense veure les notes + +STAT_MAIN=Estadístiques +STAT_MAIN_DESC=General +STAT_MAIN_WHEREAMI=Estadístiques + +STAT_OVERVIEW_INTRO=%0:s Estadístiques\nÚltima reinicialització %2:.2d.%1:.2d.%3:d +STAT_OVERVIEW_SONG=%0:d Cançons(%3:d amb Video), de les que %1:d ya han sonat i %2:d encara no s'han jugat mai.\n La cançó més popular és %5:s de %4:s. +STAT_OVERVIEW_PLAYER=Des de l'última reinicialització hi han hagut %0:d jugadors diferents.\n El millor jugador és %1:s amb una mitjana de %2:d Punts.\n %3:s ha fet la màxima puntuació amb %4:d Punts. + +STAT_DETAIL=Estadístques +STAT_DETAIL_WHEREAMI=Estadístiques + +STAT_NEXT=Següent pàgina +STAT_PREV=Pàgina anterior +STAT_REVERSE=Ordre invers +STAT_PAGE=%0:d de %1:d Pàgines\n (%2:d de %3:d Entrades) + +STAT_DESC_SCORES=Màximes puntuacions +STAT_DESC_SCORES_REVERSED=Mínimes puntuacions +STAT_FORMAT_SCORES=%0:s - %1:d [%2:s] \n (%3:s - %4:s) + +STAT_DESC_SINGERS=Millors cantants +STAT_DESC_SINGERS_REVERSED=Pitjors cantants +STAT_FORMAT_SINGERS=%0:s \n Puntuació mitjana: %1:d + +STAT_DESC_SONGS=Cançons més populars +STAT_DESC_SONGS_REVERSED=Cançons menys populars +STAT_FORMAT_SONGS=%0:s - %1:s \n %2:dx cantades + +STAT_DESC_BANDS=Grups més populars +STAT_DESC_BANDS_REVERSED=Grups menys populars +STAT_FORMAT_BANDS=%0:s \n %1:dx Cantades + +MSG_ERROR_TITLE=Error +MSG_QUESTION_TITLE=Qüestió +MSG_QUIT_USDX=Realment vols sortir d'UltraStar? +MSG_END_PARTY=Realment vols sortir del mode festa? +ERROR_NO_SONGS=No hi ha cançons +ERROR_NO_PLUGINS=No hi ha Plugins +ERROR_CORRUPT_SONG=No es poden carregar les cançons +ERROR_CORRUPT_SONG_FILE_NOT_FOUND=No es pot carregar: Fitxer no trobat +ERROR_CORRUPT_SONG_NO_NOTES=No es pot carregar: No s'han trobat notes +ERROR_CORRUPT_SONG_NO_BREAKS=No es pot carregar: No s'han trobat línies +ERROR_CORRUPT_SONG_UNKNOWN_IN_LINE=No es pot carregar: Error llegint línia %0:d diff --git a/cmake/game/languages/Croatian.ini b/cmake/game/languages/Croatian.ini index a781ee9e..38fbffb9 100644 --- a/cmake/game/languages/Croatian.ini +++ b/cmake/game/languages/Croatian.ini @@ -1,4 +1,64 @@ [Text] +OPTION_VALUE_EASY=Easy +OPTION_VALUE_MEDIUM=Medium +OPTION_VALUE_HARD=Hard + +OPTION_VALUE_ON=On +OPTION_VALUE_OFF=Off + +OPTION_VALUE_EDITION=Edition +OPTION_VALUE_GENRE=Genre +OPTION_VALUE_LANGUAGE=Language +OPTION_VALUE_FOLDER=Folder +OPTION_VALUE_TITLE=Title +OPTION_VALUE_ARTIST=Artist +OPTION_VALUE_TITLE2=Title2 +OPTION_VALUE_ARTIST2=Artist2 + +OPTION_VALUE_WHENNOVIDEO=When No Video + +OPTION_VALUE_SMALL=Small +OPTION_VALUE_BIG=Big + +OPTION_VALUE_HALF=Half +OPTION_VALUE_FULL_VID=Full (Video) +OPTION_VALUE_FULL_VID_BG=Full (BG & Video) + +OPTION_VALUE_AUTO=Auto +OPTION_VALUE_SEC=Second +OPTION_VALUE_SECS=Seconds + +OPTION_VALUE_PLAIN=Plain +OPTION_VALUE_OLINE1=OLine1 +OPTION_VALUE_OLINE2=OLine2 + +OPTION_VALUE_SIMPLE=Simple +OPTION_VALUE_ZOOM=Zoom +OPTION_VALUE_SLIDE=Slide +OPTION_VALUE_BALL=Ball +OPTION_VALUE_SHIFT=Shift + +OPTION_VALUE_EURO=Euro +OPTION_VALUE_JAPAN=Japan +OPTION_VALUE_AMERICAN=American + +OPTION_VALUE_BLUE=Blue +OPTION_VALUE_GREEN=Green +OPTION_VALUE_PINK=Pink +OPTION_VALUE_RED=Red +OPTION_VALUE_VIOLET=Violet +OPTION_VALUE_ORANGE=Orange +OPTION_VALUE_YELLOW=Yellow +OPTION_VALUE_BROWN=Brown +OPTION_VALUE_BALCK=Black + +OPTION_VALUE_SING=Sing +OPTION_VALUE_SELECT_PLAYERS=Select Players +OPTION_VALUE_OPEN_MENU=Open Menu + +OPTION_VALUE_HARDWARE_CURSOR=Hardware Cursor +OPTION_VALUE_SOFTWARE_CURSOR=Software Cursor + SING_LOADING=Uèitavanje... SING_CHOOSE_MODE=Izaberi naèin igre diff --git a/cmake/game/languages/Dutch.ini b/cmake/game/languages/Dutch.ini index d9a3691e..33dc36e2 100644 --- a/cmake/game/languages/Dutch.ini +++ b/cmake/game/languages/Dutch.ini @@ -1,4 +1,64 @@ [Text] +OPTION_VALUE_EASY=Easy +OPTION_VALUE_MEDIUM=Medium +OPTION_VALUE_HARD=Hard + +OPTION_VALUE_ON=On +OPTION_VALUE_OFF=Off + +OPTION_VALUE_EDITION=Edition +OPTION_VALUE_GENRE=Genre +OPTION_VALUE_LANGUAGE=Language +OPTION_VALUE_FOLDER=Folder +OPTION_VALUE_TITLE=Title +OPTION_VALUE_ARTIST=Artist +OPTION_VALUE_TITLE2=Title2 +OPTION_VALUE_ARTIST2=Artist2 + +OPTION_VALUE_WHENNOVIDEO=When No Video + +OPTION_VALUE_SMALL=Small +OPTION_VALUE_BIG=Big + +OPTION_VALUE_HALF=Half +OPTION_VALUE_FULL_VID=Full (Video) +OPTION_VALUE_FULL_VID_BG=Full (BG & Video) + +OPTION_VALUE_AUTO=Auto +OPTION_VALUE_SEC=Second +OPTION_VALUE_SECS=Seconds + +OPTION_VALUE_PLAIN=Plain +OPTION_VALUE_OLINE1=OLine1 +OPTION_VALUE_OLINE2=OLine2 + +OPTION_VALUE_SIMPLE=Simple +OPTION_VALUE_ZOOM=Zoom +OPTION_VALUE_SLIDE=Slide +OPTION_VALUE_BALL=Ball +OPTION_VALUE_SHIFT=Shift + +OPTION_VALUE_EURO=Euro +OPTION_VALUE_JAPAN=Japan +OPTION_VALUE_AMERICAN=American + +OPTION_VALUE_BLUE=Blue +OPTION_VALUE_GREEN=Green +OPTION_VALUE_PINK=Pink +OPTION_VALUE_RED=Red +OPTION_VALUE_VIOLET=Violet +OPTION_VALUE_ORANGE=Orange +OPTION_VALUE_YELLOW=Yellow +OPTION_VALUE_BROWN=Brown +OPTION_VALUE_BALCK=Black + +OPTION_VALUE_SING=Sing +OPTION_VALUE_SELECT_PLAYERS=Select Players +OPTION_VALUE_OPEN_MENU=Open Menu + +OPTION_VALUE_HARDWARE_CURSOR=Hardware Cursor +OPTION_VALUE_SOFTWARE_CURSOR=Software Cursor + SING_LOADING=Laden... SING_CHOOSE_MODE=kies mode diff --git a/cmake/game/languages/English.ini b/cmake/game/languages/English.ini index a65fa20e..27fd2cf2 100644 --- a/cmake/game/languages/English.ini +++ b/cmake/game/languages/English.ini @@ -1,4 +1,64 @@ [Text] +OPTION_VALUE_EASY=Easy +OPTION_VALUE_MEDIUM=Medium +OPTION_VALUE_HARD=Hard + +OPTION_VALUE_ON=On +OPTION_VALUE_OFF=Off + +OPTION_VALUE_EDITION=Edition +OPTION_VALUE_GENRE=Genre +OPTION_VALUE_LANGUAGE=Language +OPTION_VALUE_FOLDER=Folder +OPTION_VALUE_TITLE=Title +OPTION_VALUE_ARTIST=Artist +OPTION_VALUE_TITLE2=Title2 +OPTION_VALUE_ARTIST2=Artist2 + +OPTION_VALUE_WHENNOVIDEO=When No Video + +OPTION_VALUE_SMALL=Small +OPTION_VALUE_BIG=Big + +OPTION_VALUE_HALF=Half +OPTION_VALUE_FULL_VID=Full (Video) +OPTION_VALUE_FULL_VID_BG=Full (BG & Video) + +OPTION_VALUE_AUTO=Auto +OPTION_VALUE_SEC=Second +OPTION_VALUE_SECS=Seconds + +OPTION_VALUE_PLAIN=Plain +OPTION_VALUE_OLINE1=OLine1 +OPTION_VALUE_OLINE2=OLine2 + +OPTION_VALUE_SIMPLE=Simple +OPTION_VALUE_ZOOM=Zoom +OPTION_VALUE_SLIDE=Slide +OPTION_VALUE_BALL=Ball +OPTION_VALUE_SHIFT=Shift + +OPTION_VALUE_EURO=Euro +OPTION_VALUE_JAPAN=Japan +OPTION_VALUE_AMERICAN=American + +OPTION_VALUE_BLUE=Blue +OPTION_VALUE_GREEN=Green +OPTION_VALUE_PINK=Pink +OPTION_VALUE_RED=Red +OPTION_VALUE_VIOLET=Violet +OPTION_VALUE_ORANGE=Orange +OPTION_VALUE_YELLOW=Yellow +OPTION_VALUE_BROWN=Brown +OPTION_VALUE_BALCK=Black + +OPTION_VALUE_SING=Sing +OPTION_VALUE_SELECT_PLAYERS=Select Players +OPTION_VALUE_OPEN_MENU=Open Menu + +OPTION_VALUE_HARDWARE_CURSOR=Hardware Cursor +OPTION_VALUE_SOFTWARE_CURSOR=Software Cursor + SING_LOADING=Loading... SING_CHOOSE_MODE=choose mode diff --git a/cmake/game/languages/Euskara.ini b/cmake/game/languages/Euskara.ini index ce965491..a38254a7 100644 --- a/cmake/game/languages/Euskara.ini +++ b/cmake/game/languages/Euskara.ini @@ -1,4 +1,64 @@ [Text] +OPTION_VALUE_EASY=Easy +OPTION_VALUE_MEDIUM=Medium +OPTION_VALUE_HARD=Hard + +OPTION_VALUE_ON=On +OPTION_VALUE_OFF=Off + +OPTION_VALUE_EDITION=Edition +OPTION_VALUE_GENRE=Genre +OPTION_VALUE_LANGUAGE=Language +OPTION_VALUE_FOLDER=Folder +OPTION_VALUE_TITLE=Title +OPTION_VALUE_ARTIST=Artist +OPTION_VALUE_TITLE2=Title2 +OPTION_VALUE_ARTIST2=Artist2 + +OPTION_VALUE_WHENNOVIDEO=When No Video + +OPTION_VALUE_SMALL=Small +OPTION_VALUE_BIG=Big + +OPTION_VALUE_HALF=Half +OPTION_VALUE_FULL_VID=Full (Video) +OPTION_VALUE_FULL_VID_BG=Full (BG & Video) + +OPTION_VALUE_AUTO=Auto +OPTION_VALUE_SEC=Second +OPTION_VALUE_SECS=Seconds + +OPTION_VALUE_PLAIN=Plain +OPTION_VALUE_OLINE1=OLine1 +OPTION_VALUE_OLINE2=OLine2 + +OPTION_VALUE_SIMPLE=Simple +OPTION_VALUE_ZOOM=Zoom +OPTION_VALUE_SLIDE=Slide +OPTION_VALUE_BALL=Ball +OPTION_VALUE_SHIFT=Shift + +OPTION_VALUE_EURO=Euro +OPTION_VALUE_JAPAN=Japan +OPTION_VALUE_AMERICAN=American + +OPTION_VALUE_BLUE=Blue +OPTION_VALUE_GREEN=Green +OPTION_VALUE_PINK=Pink +OPTION_VALUE_RED=Red +OPTION_VALUE_VIOLET=Violet +OPTION_VALUE_ORANGE=Orange +OPTION_VALUE_YELLOW=Yellow +OPTION_VALUE_BROWN=Brown +OPTION_VALUE_BALCK=Black + +OPTION_VALUE_SING=Sing +OPTION_VALUE_SELECT_PLAYERS=Select Players +OPTION_VALUE_OPEN_MENU=Open Menu + +OPTION_VALUE_HARDWARE_CURSOR=Hardware Cursor +OPTION_VALUE_SOFTWARE_CURSOR=Software Cursor + SING_LOADING=Kargatzen... SING_CHOOSE_MODE=Aukeratu diff --git a/cmake/game/languages/Finnish.ini b/cmake/game/languages/Finnish.ini index 187b09b9..dd4bd2e5 100644 --- a/cmake/game/languages/Finnish.ini +++ b/cmake/game/languages/Finnish.ini @@ -1,4 +1,64 @@ [Text] +OPTION_VALUE_EASY=Easy +OPTION_VALUE_MEDIUM=Medium +OPTION_VALUE_HARD=Hard + +OPTION_VALUE_ON=On +OPTION_VALUE_OFF=Off + +OPTION_VALUE_EDITION=Edition +OPTION_VALUE_GENRE=Genre +OPTION_VALUE_LANGUAGE=Language +OPTION_VALUE_FOLDER=Folder +OPTION_VALUE_TITLE=Title +OPTION_VALUE_ARTIST=Artist +OPTION_VALUE_TITLE2=Title2 +OPTION_VALUE_ARTIST2=Artist2 + +OPTION_VALUE_WHENNOVIDEO=When No Video + +OPTION_VALUE_SMALL=Small +OPTION_VALUE_BIG=Big + +OPTION_VALUE_HALF=Half +OPTION_VALUE_FULL_VID=Full (Video) +OPTION_VALUE_FULL_VID_BG=Full (BG & Video) + +OPTION_VALUE_AUTO=Auto +OPTION_VALUE_SEC=Second +OPTION_VALUE_SECS=Seconds + +OPTION_VALUE_PLAIN=Plain +OPTION_VALUE_OLINE1=OLine1 +OPTION_VALUE_OLINE2=OLine2 + +OPTION_VALUE_SIMPLE=Simple +OPTION_VALUE_ZOOM=Zoom +OPTION_VALUE_SLIDE=Slide +OPTION_VALUE_BALL=Ball +OPTION_VALUE_SHIFT=Shift + +OPTION_VALUE_EURO=Euro +OPTION_VALUE_JAPAN=Japan +OPTION_VALUE_AMERICAN=American + +OPTION_VALUE_BLUE=Blue +OPTION_VALUE_GREEN=Green +OPTION_VALUE_PINK=Pink +OPTION_VALUE_RED=Red +OPTION_VALUE_VIOLET=Violet +OPTION_VALUE_ORANGE=Orange +OPTION_VALUE_YELLOW=Yellow +OPTION_VALUE_BROWN=Brown +OPTION_VALUE_BALCK=Black + +OPTION_VALUE_SING=Sing +OPTION_VALUE_SELECT_PLAYERS=Select Players +OPTION_VALUE_OPEN_MENU=Open Menu + +OPTION_VALUE_HARDWARE_CURSOR=Hardware Cursor +OPTION_VALUE_SOFTWARE_CURSOR=Software Cursor + SING_LOADING=Ladataan... SING_CHOOSE_MODE=valitse pelimuoto diff --git a/cmake/game/languages/French.ini b/cmake/game/languages/French.ini index 9afc8d7b..d79919bf 100644 --- a/cmake/game/languages/French.ini +++ b/cmake/game/languages/French.ini @@ -1,4 +1,64 @@ [Text] +OPTION_VALUE_EASY=Easy +OPTION_VALUE_MEDIUM=Medium +OPTION_VALUE_HARD=Hard + +OPTION_VALUE_ON=On +OPTION_VALUE_OFF=Off + +OPTION_VALUE_EDITION=Edition +OPTION_VALUE_GENRE=Genre +OPTION_VALUE_LANGUAGE=Language +OPTION_VALUE_FOLDER=Folder +OPTION_VALUE_TITLE=Title +OPTION_VALUE_ARTIST=Artist +OPTION_VALUE_TITLE2=Title2 +OPTION_VALUE_ARTIST2=Artist2 + +OPTION_VALUE_WHENNOVIDEO=When No Video + +OPTION_VALUE_SMALL=Small +OPTION_VALUE_BIG=Big + +OPTION_VALUE_HALF=Half +OPTION_VALUE_FULL_VID=Full (Video) +OPTION_VALUE_FULL_VID_BG=Full (BG & Video) + +OPTION_VALUE_AUTO=Auto +OPTION_VALUE_SEC=Second +OPTION_VALUE_SECS=Seconds + +OPTION_VALUE_PLAIN=Plain +OPTION_VALUE_OLINE1=OLine1 +OPTION_VALUE_OLINE2=OLine2 + +OPTION_VALUE_SIMPLE=Simple +OPTION_VALUE_ZOOM=Zoom +OPTION_VALUE_SLIDE=Slide +OPTION_VALUE_BALL=Ball +OPTION_VALUE_SHIFT=Shift + +OPTION_VALUE_EURO=Euro +OPTION_VALUE_JAPAN=Japan +OPTION_VALUE_AMERICAN=American + +OPTION_VALUE_BLUE=Blue +OPTION_VALUE_GREEN=Green +OPTION_VALUE_PINK=Pink +OPTION_VALUE_RED=Red +OPTION_VALUE_VIOLET=Violet +OPTION_VALUE_ORANGE=Orange +OPTION_VALUE_YELLOW=Yellow +OPTION_VALUE_BROWN=Brown +OPTION_VALUE_BALCK=Black + +OPTION_VALUE_SING=Sing +OPTION_VALUE_SELECT_PLAYERS=Select Players +OPTION_VALUE_OPEN_MENU=Open Menu + +OPTION_VALUE_HARDWARE_CURSOR=Hardware Cursor +OPTION_VALUE_SOFTWARE_CURSOR=Software Cursor + SING_LOADING=Chargement... SING_CHOOSE_MODE=Choisir un mode diff --git a/cmake/game/languages/German.ini b/cmake/game/languages/German.ini index 4ea0bf89..2dbc32eb 100644 --- a/cmake/game/languages/German.ini +++ b/cmake/game/languages/German.ini @@ -1,4 +1,64 @@ [Text] +OPTION_VALUE_EASY=Einfach +OPTION_VALUE_MEDIUM=Mittel +OPTION_VALUE_HARD=Schwierig + +OPTION_VALUE_ON=An +OPTION_VALUE_OFF=Aus + +OPTION_VALUE_EDITION=Edition +OPTION_VALUE_GENRE=Genre +OPTION_VALUE_LANGUAGE=Sprache +OPTION_VALUE_FOLDER=Ordner +OPTION_VALUE_TITLE=Titel +OPTION_VALUE_ARTIST=Künstler +OPTION_VALUE_TITLE2=Titel2 +OPTION_VALUE_ARTIST2=Künstler2 + +OPTION_VALUE_WHENNOVIDEO=Wenn kein Video + +OPTION_VALUE_SMALL=Klein +OPTION_VALUE_BIG=Gross + +OPTION_VALUE_HALF=Halb +OPTION_VALUE_FULL_VID=Voll (Video) +OPTION_VALUE_FULL_VID_BG=Voll (HG & Video) + +OPTION_VALUE_AUTO=Automatisch +OPTION_VALUE_SEC=Sekunde +OPTION_VALUE_SECS=Sekunden + +OPTION_VALUE_PLAIN=Einfach +OPTION_VALUE_OLINE1=OLine1 +OPTION_VALUE_OLINE2=OLine2 + +OPTION_VALUE_SIMPLE=Einfach +OPTION_VALUE_ZOOM=Vergrössern +OPTION_VALUE_SLIDE=Rutschen +OPTION_VALUE_BALL=Ball +OPTION_VALUE_SHIFT=Schieben + +OPTION_VALUE_EURO=Europäisch +OPTION_VALUE_JAPAN=Japanisch +OPTION_VALUE_AMERICAN=Amerikanisch + +OPTION_VALUE_BLUE=Blau +OPTION_VALUE_GREEN=Grün +OPTION_VALUE_PINK=Lila +OPTION_VALUE_RED=Rot +OPTION_VALUE_VIOLET=Violett +OPTION_VALUE_ORANGE=Orange +OPTION_VALUE_YELLOW=Gelb +OPTION_VALUE_BROWN=Braun +OPTION_VALUE_BALCK=Schwarz + +OPTION_VALUE_SING=Singen +OPTION_VALUE_SELECT_PLAYERS=Spieler auswählen +OPTION_VALUE_OPEN_MENU=Menu öffnen + +OPTION_VALUE_HARDWARE_CURSOR=Hardware Zeiger +OPTION_VALUE_SOFTWARE_CURSOR=Software Zeiger + SING_LOADING=Lädt... SING_CHOOSE_MODE=Modus wählen diff --git a/cmake/game/languages/Greek.ini b/cmake/game/languages/Greek.ini index c4863ec0..317f3475 100644 --- a/cmake/game/languages/Greek.ini +++ b/cmake/game/languages/Greek.ini @@ -1,5 +1,65 @@ ;Leo 21 [Text] +OPTION_VALUE_EASY=Easy +OPTION_VALUE_MEDIUM=Medium +OPTION_VALUE_HARD=Hard + +OPTION_VALUE_ON=On +OPTION_VALUE_OFF=Off + +OPTION_VALUE_EDITION=Edition +OPTION_VALUE_GENRE=Genre +OPTION_VALUE_LANGUAGE=Language +OPTION_VALUE_FOLDER=Folder +OPTION_VALUE_TITLE=Title +OPTION_VALUE_ARTIST=Artist +OPTION_VALUE_TITLE2=Title2 +OPTION_VALUE_ARTIST2=Artist2 + +OPTION_VALUE_WHENNOVIDEO=When No Video + +OPTION_VALUE_SMALL=Small +OPTION_VALUE_BIG=Big + +OPTION_VALUE_HALF=Half +OPTION_VALUE_FULL_VID=Full (Video) +OPTION_VALUE_FULL_VID_BG=Full (BG & Video) + +OPTION_VALUE_AUTO=Auto +OPTION_VALUE_SEC=Second +OPTION_VALUE_SECS=Seconds + +OPTION_VALUE_PLAIN=Plain +OPTION_VALUE_OLINE1=OLine1 +OPTION_VALUE_OLINE2=OLine2 + +OPTION_VALUE_SIMPLE=Simple +OPTION_VALUE_ZOOM=Zoom +OPTION_VALUE_SLIDE=Slide +OPTION_VALUE_BALL=Ball +OPTION_VALUE_SHIFT=Shift + +OPTION_VALUE_EURO=Euro +OPTION_VALUE_JAPAN=Japan +OPTION_VALUE_AMERICAN=American + +OPTION_VALUE_BLUE=Blue +OPTION_VALUE_GREEN=Green +OPTION_VALUE_PINK=Pink +OPTION_VALUE_RED=Red +OPTION_VALUE_VIOLET=Violet +OPTION_VALUE_ORANGE=Orange +OPTION_VALUE_YELLOW=Yellow +OPTION_VALUE_BROWN=Brown +OPTION_VALUE_BALCK=Black + +OPTION_VALUE_SING=Sing +OPTION_VALUE_SELECT_PLAYERS=Select Players +OPTION_VALUE_OPEN_MENU=Open Menu + +OPTION_VALUE_HARDWARE_CURSOR=Hardware Cursor +OPTION_VALUE_SOFTWARE_CURSOR=Software Cursor + SING_LOADING=Öüñôùíåé... SING_CHOOSE_MODE=ÅðéëïãÞ ôñüðïõ ðáé÷íéäéïý diff --git a/cmake/game/languages/Italian.ini b/cmake/game/languages/Italian.ini index d814041f..e2fe7983 100644 --- a/cmake/game/languages/Italian.ini +++ b/cmake/game/languages/Italian.ini @@ -1,4 +1,64 @@ [Text] +OPTION_VALUE_EASY=Easy +OPTION_VALUE_MEDIUM=Medium +OPTION_VALUE_HARD=Hard + +OPTION_VALUE_ON=On +OPTION_VALUE_OFF=Off + +OPTION_VALUE_EDITION=Edition +OPTION_VALUE_GENRE=Genre +OPTION_VALUE_LANGUAGE=Language +OPTION_VALUE_FOLDER=Folder +OPTION_VALUE_TITLE=Title +OPTION_VALUE_ARTIST=Artist +OPTION_VALUE_TITLE2=Title2 +OPTION_VALUE_ARTIST2=Artist2 + +OPTION_VALUE_WHENNOVIDEO=When No Video + +OPTION_VALUE_SMALL=Small +OPTION_VALUE_BIG=Big + +OPTION_VALUE_HALF=Half +OPTION_VALUE_FULL_VID=Full (Video) +OPTION_VALUE_FULL_VID_BG=Full (BG & Video) + +OPTION_VALUE_AUTO=Auto +OPTION_VALUE_SEC=Second +OPTION_VALUE_SECS=Seconds + +OPTION_VALUE_PLAIN=Plain +OPTION_VALUE_OLINE1=OLine1 +OPTION_VALUE_OLINE2=OLine2 + +OPTION_VALUE_SIMPLE=Simple +OPTION_VALUE_ZOOM=Zoom +OPTION_VALUE_SLIDE=Slide +OPTION_VALUE_BALL=Ball +OPTION_VALUE_SHIFT=Shift + +OPTION_VALUE_EURO=Euro +OPTION_VALUE_JAPAN=Japan +OPTION_VALUE_AMERICAN=American + +OPTION_VALUE_BLUE=Blue +OPTION_VALUE_GREEN=Green +OPTION_VALUE_PINK=Pink +OPTION_VALUE_RED=Red +OPTION_VALUE_VIOLET=Violet +OPTION_VALUE_ORANGE=Orange +OPTION_VALUE_YELLOW=Yellow +OPTION_VALUE_BROWN=Brown +OPTION_VALUE_BALCK=Black + +OPTION_VALUE_SING=Sing +OPTION_VALUE_SELECT_PLAYERS=Select Players +OPTION_VALUE_OPEN_MENU=Open Menu + +OPTION_VALUE_HARDWARE_CURSOR=Hardware Cursor +OPTION_VALUE_SOFTWARE_CURSOR=Software Cursor + SING_LOADING=Caricamento... SING_CHOOSE_MODE=scegli modalità diff --git a/cmake/game/languages/Portuguese.ini b/cmake/game/languages/Portuguese.ini index 08a7184a..ad2d1152 100644 --- a/cmake/game/languages/Portuguese.ini +++ b/cmake/game/languages/Portuguese.ini @@ -1,4 +1,64 @@ [Text] +OPTION_VALUE_EASY=Easy +OPTION_VALUE_MEDIUM=Medium +OPTION_VALUE_HARD=Hard + +OPTION_VALUE_ON=On +OPTION_VALUE_OFF=Off + +OPTION_VALUE_EDITION=Edition +OPTION_VALUE_GENRE=Genre +OPTION_VALUE_LANGUAGE=Language +OPTION_VALUE_FOLDER=Folder +OPTION_VALUE_TITLE=Title +OPTION_VALUE_ARTIST=Artist +OPTION_VALUE_TITLE2=Title2 +OPTION_VALUE_ARTIST2=Artist2 + +OPTION_VALUE_WHENNOVIDEO=When No Video + +OPTION_VALUE_SMALL=Small +OPTION_VALUE_BIG=Big + +OPTION_VALUE_HALF=Half +OPTION_VALUE_FULL_VID=Full (Video) +OPTION_VALUE_FULL_VID_BG=Full (BG & Video) + +OPTION_VALUE_AUTO=Auto +OPTION_VALUE_SEC=Second +OPTION_VALUE_SECS=Seconds + +OPTION_VALUE_PLAIN=Plain +OPTION_VALUE_OLINE1=OLine1 +OPTION_VALUE_OLINE2=OLine2 + +OPTION_VALUE_SIMPLE=Simple +OPTION_VALUE_ZOOM=Zoom +OPTION_VALUE_SLIDE=Slide +OPTION_VALUE_BALL=Ball +OPTION_VALUE_SHIFT=Shift + +OPTION_VALUE_EURO=Euro +OPTION_VALUE_JAPAN=Japan +OPTION_VALUE_AMERICAN=American + +OPTION_VALUE_BLUE=Blue +OPTION_VALUE_GREEN=Green +OPTION_VALUE_PINK=Pink +OPTION_VALUE_RED=Red +OPTION_VALUE_VIOLET=Violet +OPTION_VALUE_ORANGE=Orange +OPTION_VALUE_YELLOW=Yellow +OPTION_VALUE_BROWN=Brown +OPTION_VALUE_BALCK=Black + +OPTION_VALUE_SING=Sing +OPTION_VALUE_SELECT_PLAYERS=Select Players +OPTION_VALUE_OPEN_MENU=Open Menu + +OPTION_VALUE_HARDWARE_CURSOR=Hardware Cursor +OPTION_VALUE_SOFTWARE_CURSOR=Software Cursor + SING_LOADING=A Ler... SING_CHOOSE_MODE=Escolha o Modo diff --git a/cmake/game/languages/Spanish.ini b/cmake/game/languages/Spanish.ini index 7137d959..f3b36494 100644 --- a/cmake/game/languages/Spanish.ini +++ b/cmake/game/languages/Spanish.ini @@ -1,4 +1,64 @@ [Text] +OPTION_VALUE_EASY=Easy +OPTION_VALUE_MEDIUM=Medium +OPTION_VALUE_HARD=Hard + +OPTION_VALUE_ON=On +OPTION_VALUE_OFF=Off + +OPTION_VALUE_EDITION=Edition +OPTION_VALUE_GENRE=Genre +OPTION_VALUE_LANGUAGE=Language +OPTION_VALUE_FOLDER=Folder +OPTION_VALUE_TITLE=Title +OPTION_VALUE_ARTIST=Artist +OPTION_VALUE_TITLE2=Title2 +OPTION_VALUE_ARTIST2=Artist2 + +OPTION_VALUE_WHENNOVIDEO=When No Video + +OPTION_VALUE_SMALL=Small +OPTION_VALUE_BIG=Big + +OPTION_VALUE_HALF=Half +OPTION_VALUE_FULL_VID=Full (Video) +OPTION_VALUE_FULL_VID_BG=Full (BG & Video) + +OPTION_VALUE_AUTO=Auto +OPTION_VALUE_SEC=Second +OPTION_VALUE_SECS=Seconds + +OPTION_VALUE_PLAIN=Plain +OPTION_VALUE_OLINE1=OLine1 +OPTION_VALUE_OLINE2=OLine2 + +OPTION_VALUE_SIMPLE=Simple +OPTION_VALUE_ZOOM=Zoom +OPTION_VALUE_SLIDE=Slide +OPTION_VALUE_BALL=Ball +OPTION_VALUE_SHIFT=Shift + +OPTION_VALUE_EURO=Euro +OPTION_VALUE_JAPAN=Japan +OPTION_VALUE_AMERICAN=American + +OPTION_VALUE_BLUE=Blue +OPTION_VALUE_GREEN=Green +OPTION_VALUE_PINK=Pink +OPTION_VALUE_RED=Red +OPTION_VALUE_VIOLET=Violet +OPTION_VALUE_ORANGE=Orange +OPTION_VALUE_YELLOW=Yellow +OPTION_VALUE_BROWN=Brown +OPTION_VALUE_BALCK=Black + +OPTION_VALUE_SING=Sing +OPTION_VALUE_SELECT_PLAYERS=Select Players +OPTION_VALUE_OPEN_MENU=Open Menu + +OPTION_VALUE_HARDWARE_CURSOR=Hardware Cursor +OPTION_VALUE_SOFTWARE_CURSOR=Software Cursor + SING_LOADING=Cargando... SING_CHOOSE_MODE=elige modo diff --git a/cmake/game/languages/Swedish.ini b/cmake/game/languages/Swedish.ini index 1011755a..5fa5b990 100644 --- a/cmake/game/languages/Swedish.ini +++ b/cmake/game/languages/Swedish.ini @@ -1,4 +1,64 @@ [Text] +OPTION_VALUE_EASY=Easy +OPTION_VALUE_MEDIUM=Medium +OPTION_VALUE_HARD=Hard + +OPTION_VALUE_ON=On +OPTION_VALUE_OFF=Off + +OPTION_VALUE_EDITION=Edition +OPTION_VALUE_GENRE=Genre +OPTION_VALUE_LANGUAGE=Language +OPTION_VALUE_FOLDER=Folder +OPTION_VALUE_TITLE=Title +OPTION_VALUE_ARTIST=Artist +OPTION_VALUE_TITLE2=Title2 +OPTION_VALUE_ARTIST2=Artist2 + +OPTION_VALUE_WHENNOVIDEO=When No Video + +OPTION_VALUE_SMALL=Small +OPTION_VALUE_BIG=Big + +OPTION_VALUE_HALF=Half +OPTION_VALUE_FULL_VID=Full (Video) +OPTION_VALUE_FULL_VID_BG=Full (BG & Video) + +OPTION_VALUE_AUTO=Auto +OPTION_VALUE_SEC=Second +OPTION_VALUE_SECS=Seconds + +OPTION_VALUE_PLAIN=Plain +OPTION_VALUE_OLINE1=OLine1 +OPTION_VALUE_OLINE2=OLine2 + +OPTION_VALUE_SIMPLE=Simple +OPTION_VALUE_ZOOM=Zoom +OPTION_VALUE_SLIDE=Slide +OPTION_VALUE_BALL=Ball +OPTION_VALUE_SHIFT=Shift + +OPTION_VALUE_EURO=Euro +OPTION_VALUE_JAPAN=Japan +OPTION_VALUE_AMERICAN=American + +OPTION_VALUE_BLUE=Blue +OPTION_VALUE_GREEN=Green +OPTION_VALUE_PINK=Pink +OPTION_VALUE_RED=Red +OPTION_VALUE_VIOLET=Violet +OPTION_VALUE_ORANGE=Orange +OPTION_VALUE_YELLOW=Yellow +OPTION_VALUE_BROWN=Brown +OPTION_VALUE_BALCK=Black + +OPTION_VALUE_SING=Sing +OPTION_VALUE_SELECT_PLAYERS=Select Players +OPTION_VALUE_OPEN_MENU=Open Menu + +OPTION_VALUE_HARDWARE_CURSOR=Hardware Cursor +OPTION_VALUE_SOFTWARE_CURSOR=Software Cursor + SING_LOADING=Laddar... SING_CHOOSE_MODE=välj läge diff --git a/cmake/game/themes/Classic.ini b/cmake/game/themes/Classic.ini index 144448f2..1ea83f5e 100644 --- a/cmake/game/themes/Classic.ini +++ b/cmake/game/themes/Classic.ini @@ -7457,4 +7457,19 @@ H =44 Z =1 Int=1 Color =Black -Type=Font Black \ No newline at end of file +Type=Font Black + + +[SingLyricsUpperBar] +X = 80 +W = 640 +Y = 493 +H = 41 +;YOffSet (+/-) for the Sing-Indicator +IndicatorYOffset = 3 + +[SingLyricsLowerBar] +X = 80 +W = 640 +Y = 535 +H = 41 \ No newline at end of file diff --git a/cmake/game/themes/Deluxe.ini b/cmake/game/themes/Deluxe.ini index 5f47c215..e128ae54 100644 --- a/cmake/game/themes/Deluxe.ini +++ b/cmake/game/themes/Deluxe.ini @@ -1072,7 +1072,7 @@ Align = 0 X = 680 Y = 136 W = 100 -H = 13 +H = 8 #Player Two [SingP2RStatic] @@ -8150,7 +8150,6 @@ Text = OK Align = 1 Z = 1 - [PausePopUpStatic] Tex = Pause X = 0 @@ -8159,4 +8158,18 @@ W = 800 H = 600 Z = 0.95 Color = White -Type = Colorized \ No newline at end of file +Type = Colorized + +[SingLyricsUpperBar] +X = 80 +W = 640 +Y = 493 +H = 41 +;YOffSet (+/-) for the Sing-Indicator +IndicatorYOffset = 3 + +[SingLyricsLowerBar] +X = 80 +W = 640 +Y = 535 +H = 41 \ No newline at end of file diff --git a/cmake/game/themes/Deluxe/Blue.ini b/cmake/game/themes/Deluxe/Blue.ini index 30c68e3e..10017fb3 100644 --- a/cmake/game/themes/Deluxe/Blue.ini +++ b/cmake/game/themes/Deluxe/Blue.ini @@ -15,6 +15,9 @@ Color=Blue interface_selectbg_search = interface/selectbg_search.png interface_dialog_background = interface/dialog_background.png +Cursor = interface/cursor.png +Cursor_Pressed = interface/cursor_pressed.png + /** * Icons */ @@ -29,6 +32,9 @@ ButtonF = [main]buttonf.jpg MainBar = [main]mainBar.png SelectBG = [main]selectbg.png +Select_ArrowLeft = interface/select_arrow_left.png +Select_ArrowRight = interface/select_arrow_right.png + #Backgrounds LoadingBG = [bg-load]blue.jpg MainBG = [bg-main]blue.jpg @@ -43,8 +49,7 @@ PartyBG = [bg-main]blue.jpg SongCD = [icon]cd.png MainIcon = [icon]main.png IconOption = [icon]options.png -IconEdit = [icon]options.png - +IconEdit = [icon]options.png ScoreIcon = [icon]score.png PartyIcon = [icon]party.png StatIcon = [icon]stats.png @@ -52,6 +57,7 @@ StatIcon = [icon]stats.png IconError = [icon]error.png IconQuestion = [icon]question.png + # # # S O N G S E L E C E T # # # SongSelection1 = [main]songSelection1.png SongSelection2 = [main]songSelection2.png @@ -88,11 +94,12 @@ P = [sing]p.png #Pointer for lyrics Ball = [sing]LyricsBall.png + # # # S C O R E / T O P 5 # # # ScoreBox = [score]box.png -ScoreGlassBox = [score]glass_box.png +ScoreGlassBox = [score]glass_box.png ScoreLevel = [score]level.png -ScoreLevelRound = [score]levelround.png +ScoreLevelRound = [score]levelRound.png ScoreLevel_Dark = [score]level_dark.png ScoreLevel_Dark_Round = [score]level_dark_round.png @@ -132,6 +139,7 @@ Rating_6 = [score]rating_6.png Rating_7 = [score]rating_7.png # thank you girls and guys!!! + # # # P A R T Y # # # Joker =[party]Joker.png PartyPlayerButton =[party]playerButton.png @@ -153,6 +161,7 @@ PartyWinDeco1 =[party]winDecoration.png PartyWinDeco2 =[party]winDecoration.png PartyWinDeco3 =[party]winDecoration.png + # # # S T A T S # # # StatMainBG1 = [stat]mainBG1.png StatMainBG2 = [stat]mainBG2.png @@ -205,6 +214,7 @@ Rectangle = [helper]rectangle.jpg ButtonFade = [helper]buttonFade.png BGFade = [special]bg_fade.png + # # # D U E T # # # LyricIcon_P1 = [sing.player1]lyric_active.png LyricIconD_P1 = [sing.player1]lyric_inactive.png @@ -217,4 +227,4 @@ LyricIconD_P4 = [sing.player4]lyric_inactive.png LyricIcon_P5 = [sing.player5]lyric_active.png LyricIconD_P5 = [sing.player5]lyric_inactive.png LyricIcon_P6 = [sing.player6]lyric_active.png -LyricIconD_P6 = [sing.player6]lyric_inactive.png +LyricIconD_P6 = [sing.player6]lyric_inactive.png \ No newline at end of file diff --git a/cmake/game/themes/Deluxe/Fall.ini b/cmake/game/themes/Deluxe/Fall.ini index 72d9021b..38f25cdb 100644 --- a/cmake/game/themes/Deluxe/Fall.ini +++ b/cmake/game/themes/Deluxe/Fall.ini @@ -9,12 +9,32 @@ Name=Fall Color=Orange [Textures] +/** + * Interface + */ +interface_selectbg_search = interface/selectbg_search.png +interface_dialog_background = interface/dialog_background.png + +Cursor = interface/cursor.png +Cursor_Pressed = interface/cursor_pressed.png + +/** + * Icons + */ +icon_song_menu = icon/song_menu.png +icon_song_search = icon/song_search.png +icon_song_video = icon/song_video.png + + # # # M A I N # # # Button = [main]button.png ButtonF = [main]buttonf.jpg MainBar = [main]mainBar.png SelectBG = [main]selectbg.png +Select_ArrowLeft = interface/select_arrow_left.png +Select_ArrowRight = interface/select_arrow_right.png + #Backgrounds LoadingBG = [bg-load]fall.jpg MainBG = [bg-main]fall.jpg @@ -28,18 +48,16 @@ PartyBG = [bg-main]fall.jpg #Icons on screen SongCD = [icon]cd.png MainIcon = [icon]main.png -MainSearch = [icon]search.png IconOption = [icon]options.png IconEdit = [icon]options.png -IconSongMenu = [icon]songmenu.png ScoreIcon = [icon]score.png PartyIcon = [icon]party.png StatIcon = [icon]stats.png -VideoIcon = [icon]video.png IconError = [icon]error.png IconQuestion = [icon]question.png + # # # S O N G S E L E C E T # # # SongSelection1 = [main]songSelection1.png SongSelection2 = [main]songSelection2.png @@ -76,9 +94,10 @@ P = [sing]p.png #Pointer for lyrics Ball = [sing]LyricsBall.png + # # # S C O R E / T O P 5 # # # ScoreBox = [score]box.png -ScoreGlassBox = [score]glass_box.png +ScoreGlassBox = [score]glass_box.png ScoreLevel = [score]level.png ScoreLevelRound = [score]levelRound.png @@ -120,6 +139,7 @@ Rating_6 = [score]rating_6.png Rating_7 = [score]rating_7.png # thank you girls and guys!!! + # # # P A R T Y # # # Joker =[party]Joker.png PartyPlayerButton =[party]playerButton.png @@ -141,6 +161,7 @@ PartyWinDeco1 =[party]winDecoration.png PartyWinDeco2 =[party]winDecoration.png PartyWinDeco3 =[party]winDecoration.png + # # # S T A T S # # # StatMainBG1 = [stat]mainBG1.png StatMainBG2 = [stat]mainBG2.png @@ -165,7 +186,6 @@ Leiste2 = [special]bar2.png JumpToBG = [menu]jumpToBg.png SongMenuBG = [menu]songMenuBg.png SongMenuSelectBG = [menu]songMenuSelectBg.png -PopUpBG = [menu]popUpBG.png # # # N O T E S # # # @@ -183,6 +203,7 @@ NoteBGMid = [sing]notesBgMid.png NoteBGRight = [sing]notesBgRight.png Pause = [sing]pause.png + # # # E F F E C T S # # # NoteStar = [effect]goldenNoteStar.png NotePerfectStar = [effect]perfectNoteStar.png @@ -192,3 +213,18 @@ NotePerfectStar = [effect]perfectNoteStar.png Rectangle = [helper]rectangle.jpg ButtonFade = [helper]buttonFade.png BGFade = [special]bg_fade.png + + +# # # D U E T # # # +LyricIcon_P1 = [sing.player1]lyric_active.png +LyricIconD_P1 = [sing.player1]lyric_inactive.png +LyricIcon_P2 = [sing.player2]lyric_active.png +LyricIconD_P2 = [sing.player2]lyric_inactive.png +LyricIcon_P3 = [sing.player3]lyric_active.png +LyricIconD_P3 = [sing.player3]lyric_inactive.png +LyricIcon_P4 = [sing.player4]lyric_active.png +LyricIconD_P4 = [sing.player4]lyric_inactive.png +LyricIcon_P5 = [sing.player5]lyric_active.png +LyricIconD_P5 = [sing.player5]lyric_inactive.png +LyricIcon_P6 = [sing.player6]lyric_active.png +LyricIconD_P6 = [sing.player6]lyric_inactive.png \ No newline at end of file diff --git a/cmake/game/themes/Deluxe/Ocean.ini b/cmake/game/themes/Deluxe/Ocean.ini new file mode 100644 index 00000000..bdc90979 --- /dev/null +++ b/cmake/game/themes/Deluxe/Ocean.ini @@ -0,0 +1,230 @@ +;0.5.1 +;experimental version +;if you are using this as a sample for your theme +;don't be suprised it doesn't work good with newer releases + +[Skin] +Theme=Deluxe +Name=Ocean +Color=Blue + +[Textures] +/** + * Interface + */ +interface_selectbg_search = interface/selectbg_search.png +interface_dialog_background = interface/dialog_background.png + +Cursor = interface/cursor.png +Cursor_Pressed = interface/cursor_pressed.png + +/** + * Icons + */ +icon_song_menu = icon/song_menu.png +icon_song_search = icon/song_search.png +icon_song_video = icon/song_video.png + + +# # # M A I N # # # +Button = [main]button.png +ButtonF = [main]buttonf.jpg +MainBar = [main]mainBar.png +SelectBG = [main]selectbg.png + +Select_ArrowLeft = interface/select_arrow_left.png +Select_ArrowRight = interface/select_arrow_right.png + +#Backgrounds +LoadingBG = [bg-load]blue.jpg +MainBG = [bg-video]_ocean.avi +SongBG = [bg-video]_ocean.avi +ScoreScreenBG = [bg-video]_ocean.avi +Top5BG = [bg-video]_ocean.avi +OptionsBG = [bg-video]_ocean.avi +EditBG = [bg-video]_ocean.avi +PartyBG = [bg-video]_ocean.avi + +#Icons on screen +SongCD = [icon]cd.png +MainIcon = [icon]main.png +IconOption = [icon]options.png +IconEdit = [icon]options.png +ScoreIcon = [icon]score.png +PartyIcon = [icon]party.png +StatIcon = [icon]stats.png + +IconError = [icon]error.png +IconQuestion = [icon]question.png + + +# # # S O N G S E L E C E T # # # +SongSelection1 = [main]songSelection1.png +SongSelection2 = [main]songSelection2.png +SongCover = [main]songCover.jpg + + +# # # S I N G # # # +#the bar where the lyrics reside +LyricBar = [sing]textBar.png + +#this one slides in, to tell you that singing starts immediately +LyricHelpBar = [sing]lyricsHelpBar.png + +#the bar behind the timestuff +TimeBar1 = [sing]timeBarBG.png + +#the time progress bar (not skinned in this theme :P ) +TimeBar = [sing]timeBar.jpg + +#linebonus, the thing that pop ups at the score +LineBonusBack = [sing]lineBonusPopUp.png + +#Singbar (the thing beneath the scores) +SingBarBack = [sing]singBarBack.png +SingBarBar = [sing]singBarBar.png +SingBarFront = [sing]singBarFront.png + +#Background for scores +ScoreBG = [sing]scoreBg.png + +#Background for the P1, P2 and so on +P = [sing]p.png + +#Pointer for lyrics +Ball = [sing]LyricsBall.png + + +# # # S C O R E / T O P 5 # # # +ScoreBox = [score]box.png +ScoreGlassBox = [score]glass_box.png +ScoreLevel = [score]level.png +ScoreLevelRound = [score]levelRound.png + +ScoreLevel_Dark = [score]level_dark.png +ScoreLevel_Dark_Round = [score]level_dark_round.png + +ScoreLevel_Light = [score]level_light.png +ScoreLevel_Light_Round = [score]level_light_round.png + +ScoreLevel_Lightest = [score]level_lightest.png +ScoreLevel_Lightest_Round = [score]level_lightest_round.png + +# Boxes near the text, that show what color is for which bar +ScoreBar_box_lightest = [score]bar_box_lightest.png +ScoreBar_box_light = [score]bar_box_light.png +ScoreBar_box_dark = [score]bar_box_dark.png + +ScoreEndCap = [score]endcap.png +ScoreLine = [score]line.png +PlayerNumberBox = [main]playerNumberBox.png + +PlayerIDBox01 = [sing.player1]lyric_active.png +PlayerIDBox02 = [sing.player2]lyric_active.png +PlayerIDBox03 = [sing.player3]lyric_active.png +PlayerIDBox04 = [sing.player4]lyric_active.png +PlayerIDBox05 = [sing.player5]lyric_active.png +PlayerIDBox06 = [sing.player6]lyric_active.png + +# these icons are part of the tango icon set +# licensed under Creative Commons Attribution Share-Alike license +# http://tango.freedesktop.org +Rating_0 = [score]rating_0.png +Rating_1 = [score]rating_1.png +Rating_2 = [score]rating_2.png +Rating_3 = [score]rating_3.png +Rating_4 = [score]rating_4.png +Rating_5 = [score]rating_5.png +Rating_6 = [score]rating_6.png +Rating_7 = [score]rating_7.png +# thank you girls and guys!!! + + +# # # P A R T Y # # # +Joker =[party]Joker.png +PartyPlayerButton =[party]playerButton.png +PartyTeamButton1 =[party]roundTeamButton.png +PartyTeamButton2 =[party]playerTeamButton.png +PartyTeamButton3 =[party]winTeamButton1.png +PartyTeamButton4 =[party]winTeamButton2.png +PartyTeamButton5 =[party]winTeamButton3.png +PartyRoundBG1 =[party]roundBG1.png +PartyRoundBG2 =[party]roundBG2.png +PartyRoundBG3 =[party]roundBG3.png +PartyRoundBG4 =[party]roundBG4.png +HDL_Pointer =[party]pointer.png +PartyTeamPoints =[party]teamPoints.png +PartyScoreDeco =[party]scoreDecoration.png +PartyScoreBG1 =[party]scoreBG1.png +PartyScoreBG2 =[party]scoreBG2.png +PartyWinDeco1 =[party]winDecoration.png +PartyWinDeco2 =[party]winDecoration.png +PartyWinDeco3 =[party]winDecoration.png + + +# # # S T A T S # # # +StatMainBG1 = [stat]mainBG1.png +StatMainBG2 = [stat]mainBG2.png +StatMainBG3 = [stat]mainBG3.png +StatDetailBG1 = [stat]detailBG1.png + + +# # # N A V I # # # +ButtonP = [button]p.png +ButtonM = [button]m.png +ButtonJ = [button]j.png +ButtonAlt = [button]alt.png +ButtonAZ = [button]az.png +ButtonEnter = [button]enter.png +ButtonNavi = [button]navi.png +ButtonEsc = [button]esc.png +Button13 = [button]13.png + +Leiste1 = [special]bar1.png +Leiste2 = [special]bar2.png + +JumpToBG = [menu]jumpToBg.png +SongMenuBG = [menu]songMenuBg.png +SongMenuSelectBG = [menu]songMenuSelectBg.png + + +# # # N O T E S # # # +# sung notes - colorized with playercolors +GrayLeft = [sing]notesLeft.png +GrayMid = [sing]notesMid.png +GrayRight = [sing]notesRight.png +# unsung notes - colorized with playercolors +NotePlainLeft = [sing]notesPlainLeft.png +NotePlainMid = [sing]notesPlainMid.png +NotePlainRight = [sing]notesPlainRight.png +# the glow around unsung/sung notes - colorized with playercolors +NoteBGLeft = [sing]notesBgLeft.png +NoteBGMid = [sing]notesBgMid.png +NoteBGRight = [sing]notesBgRight.png +Pause = [sing]pause.png + + +# # # E F F E C T S # # # +NoteStar = [effect]goldenNoteStar.png +NotePerfectStar = [effect]perfectNoteStar.png + + +# # # dirty helpers # # # +Rectangle = [helper]rectangle.jpg +ButtonFade = [helper]buttonFade.png +BGFade = [special]bg_fade.png + + +# # # D U E T # # # +LyricIcon_P1 = [sing.player1]lyric_active.png +LyricIconD_P1 = [sing.player1]lyric_inactive.png +LyricIcon_P2 = [sing.player2]lyric_active.png +LyricIconD_P2 = [sing.player2]lyric_inactive.png +LyricIcon_P3 = [sing.player3]lyric_active.png +LyricIconD_P3 = [sing.player3]lyric_inactive.png +LyricIcon_P4 = [sing.player4]lyric_active.png +LyricIconD_P4 = [sing.player4]lyric_inactive.png +LyricIcon_P5 = [sing.player5]lyric_active.png +LyricIconD_P5 = [sing.player5]lyric_inactive.png +LyricIcon_P6 = [sing.player6]lyric_active.png +LyricIconD_P6 = [sing.player6]lyric_inactive.png \ No newline at end of file diff --git a/cmake/game/themes/Deluxe/Ribbon.ini b/cmake/game/themes/Deluxe/Ribbon.ini index 1631183e..73cae2ab 100644 --- a/cmake/game/themes/Deluxe/Ribbon.ini +++ b/cmake/game/themes/Deluxe/Ribbon.ini @@ -1,4 +1,4 @@ -never;0.5.1 +;0.5.1 ;experimental version ;if you are using this as a sample for your theme ;don't be suprised it doesn't work good with newer releases @@ -6,9 +6,25 @@ never;0.5.1 [Skin] Theme=Deluxe Name=Ribbon -Color=Ani +Color=Any [Textures] +/** + * Interface + */ +interface_selectbg_search = interface/selectbg_search.png +interface_dialog_background = interface/dialog_background.png + +Cursor = interface/cursor.png +Cursor_Pressed = interface/cursor_pressed.png + +/** + * Icons + */ +icon_song_menu = icon/song_menu.png +icon_song_search = icon/song_search.png +icon_song_video = icon/song_video.png + # # # M A I N # # # Button = [main]button.png @@ -16,6 +32,9 @@ ButtonF = [main]buttonf.jpg MainBar = [main]mainBar.png SelectBG = [main]selectbg.png +Select_ArrowLeft = interface/select_arrow_left.png +Select_ArrowRight = interface/select_arrow_right.png + #Backgrounds LoadingBG = [bg-video]ribbon.mov MainBG = [bg-video]ribbon.mov @@ -29,18 +48,16 @@ PartyBG = [bg-video]ribbon.mov #Icons on screen SongCD = [icon]cd.png MainIcon = [icon]main.png -MainSearch = [icon]search.png IconOption = [icon]options.png IconEdit = [icon]options.png -IconSongMenu = [icon]songmenu.png ScoreIcon = [icon]score.png PartyIcon = [icon]party.png StatIcon = [icon]stats.png -VideoIcon = [icon]video.png IconError = [icon]error.png IconQuestion = [icon]question.png + # # # S O N G S E L E C E T # # # SongSelection1 = [main]songSelection1.png SongSelection2 = [main]songSelection2.png @@ -80,9 +97,9 @@ Ball = [sing]LyricsBall.png # # # S C O R E / T O P 5 # # # ScoreBox = [score]box.png -ScoreGlassBox = [score]glass_box.png +ScoreGlassBox = [score]glass_box.png ScoreLevel = [score]level.png -ScoreLevelRound = [score]levelround.png +ScoreLevelRound = [score]levelRound.png ScoreLevel_Dark = [score]level_dark.png ScoreLevel_Dark_Round = [score]level_dark_round.png @@ -122,6 +139,7 @@ Rating_6 = [score]rating_6.png Rating_7 = [score]rating_7.png # thank you girls and guys!!! + # # # P A R T Y # # # Joker =[party]Joker.png PartyPlayerButton =[party]playerButton.png @@ -143,6 +161,7 @@ PartyWinDeco1 =[party]winDecoration.png PartyWinDeco2 =[party]winDecoration.png PartyWinDeco3 =[party]winDecoration.png + # # # S T A T S # # # StatMainBG1 = [stat]mainBG1.png StatMainBG2 = [stat]mainBG2.png @@ -167,7 +186,6 @@ Leiste2 = [special]bar2.png JumpToBG = [menu]jumpToBg.png SongMenuBG = [menu]songMenuBg.png SongMenuSelectBG = [menu]songMenuSelectBg.png -PopUpBG = [menu]popUpBG.png # # # N O T E S # # # @@ -183,6 +201,7 @@ NotePlainRight = [sing]notesPlainRight.png NoteBGLeft = [sing]notesBgLeft.png NoteBGMid = [sing]notesBgMid.png NoteBGRight = [sing]notesBgRight.png +Pause = [sing]pause.png # # # E F F E C T S # # # @@ -194,3 +213,18 @@ NotePerfectStar = [effect]perfectNoteStar.png Rectangle = [helper]rectangle.jpg ButtonFade = [helper]buttonFade.png BGFade = [special]bg_fade.png + + +# # # D U E T # # # +LyricIcon_P1 = [sing.player1]lyric_active.png +LyricIconD_P1 = [sing.player1]lyric_inactive.png +LyricIcon_P2 = [sing.player2]lyric_active.png +LyricIconD_P2 = [sing.player2]lyric_inactive.png +LyricIcon_P3 = [sing.player3]lyric_active.png +LyricIconD_P3 = [sing.player3]lyric_inactive.png +LyricIcon_P4 = [sing.player4]lyric_active.png +LyricIconD_P4 = [sing.player4]lyric_inactive.png +LyricIcon_P5 = [sing.player5]lyric_active.png +LyricIconD_P5 = [sing.player5]lyric_inactive.png +LyricIcon_P6 = [sing.player6]lyric_active.png +LyricIconD_P6 = [sing.player6]lyric_inactive.png \ No newline at end of file diff --git a/cmake/game/themes/Deluxe/Summer.ini b/cmake/game/themes/Deluxe/Summer.ini index 3d40c2f8..36e9f5d7 100644 --- a/cmake/game/themes/Deluxe/Summer.ini +++ b/cmake/game/themes/Deluxe/Summer.ini @@ -9,12 +9,32 @@ Name=Summer Color=Blue [Textures] +/** + * Interface + */ +interface_selectbg_search = interface/selectbg_search.png +interface_dialog_background = interface/dialog_background.png + +Cursor = interface/cursor.png +Cursor_Pressed = interface/cursor_pressed.png + +/** + * Icons + */ +icon_song_menu = icon/song_menu.png +icon_song_search = icon/song_search.png +icon_song_video = icon/song_video.png + + # # # M A I N # # # Button = [main]button.png ButtonF = [main]buttonf.jpg MainBar = [main]mainBar.png SelectBG = [main]selectbg.png +Select_ArrowLeft = interface/select_arrow_left.png +Select_ArrowRight = interface/select_arrow_right.png + #Backgrounds LoadingBG = [bg-load]summer.jpg MainBG = [bg-main]summer.jpg @@ -28,18 +48,16 @@ PartyBG = [bg-main]summer.jpg #Icons on screen SongCD = [icon]cd.png MainIcon = [icon]main.png -MainSearch = [icon]search.png IconOption = [icon]options.png IconEdit = [icon]options.png -IconSongMenu = [icon]songmenu.png ScoreIcon = [icon]score.png PartyIcon = [icon]party.png StatIcon = [icon]stats.png -VideoIcon = [icon]video.png IconError = [icon]error.png IconQuestion = [icon]question.png + # # # S O N G S E L E C E T # # # SongSelection1 = [main]songSelection1.png SongSelection2 = [main]songSelection2.png @@ -76,9 +94,10 @@ P = [sing]p.png #Pointer for lyrics Ball = [sing]LyricsBall.png + # # # S C O R E / T O P 5 # # # ScoreBox = [score]box.png -ScoreGlassBox = [score]glass_box.png +ScoreGlassBox = [score]glass_box.png ScoreLevel = [score]level.png ScoreLevelRound = [score]levelRound.png @@ -120,6 +139,7 @@ Rating_6 = [score]rating_6.png Rating_7 = [score]rating_7.png # thank you girls and guys!!! + # # # P A R T Y # # # Joker =[party]Joker.png PartyPlayerButton =[party]playerButton.png @@ -141,6 +161,7 @@ PartyWinDeco1 =[party]winDecoration.png PartyWinDeco2 =[party]winDecoration.png PartyWinDeco3 =[party]winDecoration.png + # # # S T A T S # # # StatMainBG1 = [stat]mainBG1.png StatMainBG2 = [stat]mainBG2.png @@ -165,7 +186,6 @@ Leiste2 = [special]bar2.png JumpToBG = [menu]jumpToBg.png SongMenuBG = [menu]songMenuBg.png SongMenuSelectBG = [menu]songMenuSelectBg.png -PopUpBG = [menu]popUpBG.png # # # N O T E S # # # @@ -183,6 +203,7 @@ NoteBGMid = [sing]notesBgMid.png NoteBGRight = [sing]notesBgRight.png Pause = [sing]pause.png + # # # E F F E C T S # # # NoteStar = [effect]goldenNoteStar.png NotePerfectStar = [effect]perfectNoteStar.png @@ -192,3 +213,18 @@ NotePerfectStar = [effect]perfectNoteStar.png Rectangle = [helper]rectangle.jpg ButtonFade = [helper]buttonFade.png BGFade = [special]bg_fade.png + + +# # # D U E T # # # +LyricIcon_P1 = [sing.player1]lyric_active.png +LyricIconD_P1 = [sing.player1]lyric_inactive.png +LyricIcon_P2 = [sing.player2]lyric_active.png +LyricIconD_P2 = [sing.player2]lyric_inactive.png +LyricIcon_P3 = [sing.player3]lyric_active.png +LyricIconD_P3 = [sing.player3]lyric_inactive.png +LyricIcon_P4 = [sing.player4]lyric_active.png +LyricIconD_P4 = [sing.player4]lyric_inactive.png +LyricIcon_P5 = [sing.player5]lyric_active.png +LyricIconD_P5 = [sing.player5]lyric_inactive.png +LyricIcon_P6 = [sing.player6]lyric_active.png +LyricIconD_P6 = [sing.player6]lyric_inactive.png \ No newline at end of file diff --git a/cmake/game/themes/Deluxe/Winter.ini b/cmake/game/themes/Deluxe/Winter.ini index 32c37a02..72514a15 100644 --- a/cmake/game/themes/Deluxe/Winter.ini +++ b/cmake/game/themes/Deluxe/Winter.ini @@ -9,12 +9,32 @@ Name=Winter Color=Blue [Textures] +/** + * Interface + */ +interface_selectbg_search = interface/selectbg_search.png +interface_dialog_background = interface/dialog_background.png + +Cursor = interface/cursor.png +Cursor_Pressed = interface/cursor_pressed.png + +/** + * Icons + */ +icon_song_menu = icon/song_menu.png +icon_song_search = icon/song_search.png +icon_song_video = icon/song_video.png + + # # # M A I N # # # Button = [main]button.png ButtonF = [main]buttonf.jpg MainBar = [main]mainBar.png SelectBG = [main]selectbg.png +Select_ArrowLeft = interface/select_arrow_left.png +Select_ArrowRight = interface/select_arrow_right.png + #Backgrounds LoadingBG = [bg-load]winter.jpg MainBG = [bg-main]winter.jpg @@ -28,18 +48,16 @@ PartyBG = [bg-main]winter.jpg #Icons on screen SongCD = [icon]cd.png MainIcon = [icon]main.png -MainSearch = [icon]search.png IconOption = [icon]options.png IconEdit = [icon]options.png -IconSongMenu = [icon]songmenu.png ScoreIcon = [icon]score.png PartyIcon = [icon]party.png StatIcon = [icon]stats.png -VideoIcon = [icon]video.png IconError = [icon]error.png IconQuestion = [icon]question.png + # # # S O N G S E L E C E T # # # SongSelection1 = [main]songSelection1.png SongSelection2 = [main]songSelection2.png @@ -79,7 +97,7 @@ Ball = [sing]LyricsBall.png # # # S C O R E / T O P 5 # # # ScoreBox = [score]box.png -ScoreGlassBox = [score]glass_box.png +ScoreGlassBox = [score]glass_box.png ScoreLevel = [score]level.png ScoreLevelRound = [score]levelRound.png @@ -121,6 +139,7 @@ Rating_6 = [score]rating_6.png Rating_7 = [score]rating_7.png # thank you girls and guys!!! + # # # P A R T Y # # # Joker =[party]Joker.png PartyPlayerButton =[party]playerButton.png @@ -142,6 +161,7 @@ PartyWinDeco1 =[party]winDecoration.png PartyWinDeco2 =[party]winDecoration.png PartyWinDeco3 =[party]winDecoration.png + # # # S T A T S # # # StatMainBG1 = [stat]mainBG1.png StatMainBG2 = [stat]mainBG2.png @@ -166,7 +186,6 @@ Leiste2 = [special]bar2.png JumpToBG = [menu]jumpToBg.png SongMenuBG = [menu]songMenuBg.png SongMenuSelectBG = [menu]songMenuSelectBg.png -PopUpBG = [menu]popUpBG.png # # # N O T E S # # # @@ -184,6 +203,7 @@ NoteBGMid = [sing]notesBgMid.png NoteBGRight = [sing]notesBgRight.png Pause = [sing]pause.png + # # # E F F E C T S # # # NoteStar = [effect]goldenNoteStar.png NotePerfectStar = [effect]perfectNoteStar.png @@ -193,3 +213,18 @@ NotePerfectStar = [effect]perfectNoteStar.png Rectangle = [helper]rectangle.jpg ButtonFade = [helper]buttonFade.png BGFade = [special]bg_fade.png + + +# # # D U E T # # # +LyricIcon_P1 = [sing.player1]lyric_active.png +LyricIconD_P1 = [sing.player1]lyric_inactive.png +LyricIcon_P2 = [sing.player2]lyric_active.png +LyricIconD_P2 = [sing.player2]lyric_inactive.png +LyricIcon_P3 = [sing.player3]lyric_active.png +LyricIconD_P3 = [sing.player3]lyric_inactive.png +LyricIcon_P4 = [sing.player4]lyric_active.png +LyricIconD_P4 = [sing.player4]lyric_inactive.png +LyricIcon_P5 = [sing.player5]lyric_active.png +LyricIconD_P5 = [sing.player5]lyric_inactive.png +LyricIcon_P6 = [sing.player6]lyric_active.png +LyricIconD_P6 = [sing.player6]lyric_inactive.png \ No newline at end of file diff --git a/cmake/game/themes/Deluxe/[main]selectbg.png b/cmake/game/themes/Deluxe/[main]selectbg.png index 093be9a5..f1b69eca 100644 Binary files a/cmake/game/themes/Deluxe/[main]selectbg.png and b/cmake/game/themes/Deluxe/[main]selectbg.png differ diff --git a/cmake/game/themes/Deluxe/interface/cursor.png b/cmake/game/themes/Deluxe/interface/cursor.png new file mode 100644 index 00000000..6c222732 Binary files /dev/null and b/cmake/game/themes/Deluxe/interface/cursor.png differ diff --git a/cmake/game/themes/Deluxe/interface/cursor_pressed.png b/cmake/game/themes/Deluxe/interface/cursor_pressed.png new file mode 100644 index 00000000..3fc36a5a Binary files /dev/null and b/cmake/game/themes/Deluxe/interface/cursor_pressed.png differ diff --git a/cmake/game/themes/Deluxe/interface/select_arrow_left.png b/cmake/game/themes/Deluxe/interface/select_arrow_left.png new file mode 100644 index 00000000..e4a32d2d Binary files /dev/null and b/cmake/game/themes/Deluxe/interface/select_arrow_left.png differ diff --git a/cmake/game/themes/Deluxe/interface/select_arrow_right.png b/cmake/game/themes/Deluxe/interface/select_arrow_right.png new file mode 100644 index 00000000..b2a29793 Binary files /dev/null and b/cmake/game/themes/Deluxe/interface/select_arrow_right.png differ diff --git a/cmake/plugins/Blind/Blind.dpr b/cmake/plugins/Blind/Blind.dpr index 82721102..3c68374c 100644 --- a/cmake/plugins/Blind/Blind.dpr +++ b/cmake/plugins/Blind/Blind.dpr @@ -69,7 +69,7 @@ var begin Result := 0; MaxScore := 0; - for Index := 0 to PlayerInfo.NumPlayers-1 do + for Index := 0 to PlayerInfo.NumPlayers - 1 do begin PlayerInfo.Playerinfo[Index].Percentage := PlayerInfo.Playerinfo[Index].Score div 9999; if (PlayerInfo.Playerinfo[Index].Score > MaxScore) then diff --git a/cmake/plugins/Dont_Get_Worse/Hold_The_Line.dpr b/cmake/plugins/Dont_Get_Worse/Hold_The_Line.dpr index 583a0b94..a7828f8e 100644 --- a/cmake/plugins/Dont_Get_Worse/Hold_The_Line.dpr +++ b/cmake/plugins/Dont_Get_Worse/Hold_The_Line.dpr @@ -5,18 +5,16 @@ library Hold_The_Line; {$ENDIF} uses - ModiSDK in '..\SDK\ModiSDK.pas', -// USDXStrUtils in '..\SDK\USDXStrUtils.pas', - sdl in '..\..\src\lib\JEDI-SDL\SDL\Pas\sdl.pas', - moduleloader in '..\..\src\lib\JEDI-SDL\SDL\Pas\moduleloader.pas', - gl in '..\..\src\lib\JEDI-SDL\OpenGL\Pas\gl.pas'; + SysUtils, + ModiSDK in '..\SDK\ModiSDK.pas', + gl in '..\..\src\lib\JEDI-SDL\OpenGL\Pas\gl.pas'; var PointerTex: TSmallTexture; CountSentences: cardinal; Limit: byte; MethodRec: TMethodRec; - Frame: integer; +// Frame: integer; PlayerTimes: array[0..5] of integer; LastTick: cardinal; PointerVisible: boolean; @@ -92,7 +90,7 @@ begin CountSentences := Sentences.High; Limit := 0; - Frame := 0; +// Frame := 0; MethodRec := Methods; @@ -115,14 +113,12 @@ var Index: integer; L: byte; C: byte; -// Text: PChar; - Blink: boolean; Tick: cardinal; begin // activate blink if (CurSentence = CountSentences div 5 * 2 - 1) or (CurSentence = CountSentences div 3 * 2 - 1) then begin - Tick := SDL_GetTicks() div 400; + Tick := round(TimeStampToMSecs(DateTimeToTimeStamp(Now))) div 400; if (Tick <> LastTick) then begin LastTick := Tick; @@ -188,14 +184,7 @@ begin begin Inc(C); // Draw dismissed -// Text := CreateStr(PChar('PARTY_DISMISSED')); - glColor4f (0.8, 0.8, 0.8, 1); - -{ - MethodRec.Print (1, 18, PlayerInfo.Playerinfo[Index].PosX, PlayerInfo.Playerinfo[Index].PosY-8, Text); - FreeStr(Text); -} MethodRec.Print (1, 18, PlayerInfo.Playerinfo[Index].PosX, PlayerInfo.Playerinfo[Index].PosY-8, SoundName); end; end; diff --git a/cmake/plugins/README(Plugins Status).txt b/cmake/plugins/README(Plugins Status).txt index 6a371da0..a6756832 100644 --- a/cmake/plugins/README(Plugins Status).txt +++ b/cmake/plugins/README(Plugins Status).txt @@ -1,3 +1,6 @@ +All plugins are cleared off the SDL stuff (basically SDL_GetTicks), the StrUtils and moduleloader unit and should work on all platforms. +2009-May-23 KMS + Mac OS X: The following plugins can be compiled and used after being put in to the plugins folder: Blind, 5000Points, Duell diff --git a/cmake/plugins/SDK/ModiSDK.pas b/cmake/plugins/SDK/ModiSDK.pas index 7fc50bb8..e0b52a81 100644 --- a/cmake/plugins/SDK/ModiSDK.pas +++ b/cmake/plugins/SDK/ModiSDK.pas @@ -9,11 +9,11 @@ interface type // PluginInfo, for init TPluginInfo = record // Info - Name: array [0..32] of char; // modi to register for the plugin + Name: array [0..32] of char; // modus to register for the plugin Creator: array [0..32] of char; // name of the author PluginDesc: array [0..64] of char; // plugin description - // plugin type, atm: 8 only for partymode modi + // plugin type, atm: 8 only for partymode modus Case Typ: byte of 8: ( // Options @@ -37,7 +37,7 @@ type // PluginInfo, for init ShowBars: boolean; // Whether the white bars on top and bottom should be drawn TeamModeOnly: boolean; // If true the plugin can only be played in team mode GetSoundData: boolean; // If true the rdata procedure is called when new sound data is available - Dummy: boolean; // Should be set to false... for updateing plugin interface + Dummy: boolean; // Should be set to false... for updating plugin interface NumPlayers: byte // Number of available players for modus // Set different bits @@ -54,13 +54,13 @@ type // PluginInfo, for init TPlayerInfo = record NumPlayers: byte; Playerinfo: array[0..5] of record - Name: PChar; // Name of the player - Score: word; // Players score - Bar: byte; // Percentage of the singbar filled - PosX: real; // PosX of players singbar - PosY: real; // PosY " + Name: PChar; // Name of the player + Score: word; // Player's score + Bar: byte; // Percentage of the singbar filled + PosX: real; // PosX of player's singbar + PosY: real; // PosY " Enabled: boolean; // Whether the player could get points - Percentage: byte; // Percentage shown on the score screen + Percentage: byte; // Percentage shown on the score screen end; end; @@ -86,7 +86,7 @@ type // PluginInfo, for init end; TSentences = record - Current: integer; // aktualna czesc utworu do rysowania + Current: integer; // current part of a line High: integer; Number: integer; Resolution: integer; @@ -109,12 +109,12 @@ type // PluginInfo, for init Tone: integer; //Text: string; FreeStyle: boolean; - Typ: integer; // zwykla nuta x1, zlota nuta x2 + Typ: integer; // normal note x1, golden note x2 end; end; end; - dword = longword; + dword = longword; hstream = dword; TTextureType = ( @@ -156,7 +156,7 @@ type // PluginInfo, for init fModi_Finish = function (var Playerinfo: TPlayerinfo): byte; {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} // Procedure called when new sound data is available - pModi_RData = procedure (handle: HSTREAM; buffer: Pointer; len: DWORD; user: DWORD); + pModi_RData = procedure (handle: hstream; buffer: pointer; len: dword; user: dword); {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} implementation diff --git a/cmake/plugins/Team_Duell/TeamDuell.dpr b/cmake/plugins/Team_Duell/TeamDuell.dpr index 7937a78c..1371c95d 100644 --- a/cmake/plugins/Team_Duell/TeamDuell.dpr +++ b/cmake/plugins/Team_Duell/TeamDuell.dpr @@ -4,15 +4,10 @@ library TeamDuell ; {$MODE Delphi} {$ENDIF} -// compile with fpc -k-U -k_SDL_main TeamDuell.dpr -Fi../../src/lib/JEDI-SDL/SDL/Pas/ - uses - ModiSDK in '..\SDK\ModiSDK.pas', -// USDXStrUtils in '..\SDK\USDXStrUtils.pas', - sdl in '..\..\src\lib\JEDI-SDL\SDL\Pas\sdl.pas', - moduleloader in '..\..\src\lib\JEDI-SDL\SDL\Pas\moduleloader.pas', - gl in '..\..\src\lib\JEDI-SDL\OpenGL\Pas\gl.pas', - sysutils; + SysUtils, + ModiSDK in '..\SDK\ModiSDK.pas', + gl in '..\..\src\lib\JEDI-SDL\OpenGL\Pas\gl.pas'; var TeamPlayer: array of array of string; @@ -24,6 +19,12 @@ var bps, RTimeToNextChange: double; firsttime, secondtime: boolean; +function GetTicks: cardinal; +// returns a time stamp in milliseconds +begin + GetTicks := round(TimeStampToMSecs(DateTimeToTimeStamp(Now))); +end; + // Give the plugin's info procedure PluginInfo (var Info: TPluginInfo); {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} begin @@ -92,7 +93,7 @@ begin until not(NextSinger[Index] = CurSinger[Index]) or (SPT[Index] = 1); end; ChangeOnSentence := 8; - starttick := SDL_GetTicks(); + starttick := GetTicks; firsttime := true; secondtime := true; bps := 1; @@ -114,11 +115,11 @@ begin if (CurSentence = ChangeOnSentence - 7) and (firsttime) then begin firsttime := false; - starttick := SDL_GetTicks(); + starttick := GetTicks; end; start := false; // show first singer for 5 sec - if (CurSentence < 1) and ((starttick + 5000) > SDL_GetTicks()) then + if (CurSentence < 1) and ((starttick + 5000) > GetTicks) then start := true; // TickCount(thirdSentence) @@ -126,12 +127,12 @@ begin begin secondtime := false; firsttime := true; - endtick := SDL_GetTicks(); + endtick := GetTicks; bps := (Startpoints[3]-Startpoints[1]) * 1000 / (endtick-starttick); // BeatsPerSecond end; // Time to next change - RTimeToNextChange := ((Startpoints[ChangeOnSentence]-Startpoints[ChangeOnSentence - 7]) / bps) - ((SDL_GetTicks() - starttick) / 1000); + RTimeToNextChange := ((Startpoints[ChangeOnSentence]-Startpoints[ChangeOnSentence - 7]) / bps) - ((GetTicks - starttick) / 1000); TimeToNextChange := Trunc(RTimeToNextChange) + 1; // Next singer for team I @@ -222,7 +223,7 @@ end; // is executed on finish, returns the player number of the winner function Finish (var Playerinfo: TPlayerinfo): byte; {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} var - Index: integer; + Index: integer; MaxScore: word; begin Result := 0; diff --git a/cmake/src/base/UBeatTimer.pas b/cmake/src/base/UBeatTimer.pas new file mode 100644 index 00000000..a47a06f9 --- /dev/null +++ b/cmake/src/base/UBeatTimer.pas @@ -0,0 +1,170 @@ + {* UltraStar Deluxe - Karaoke Game + * + * UltraStar Deluxe 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; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $URL: https://ultrastardx.svn.sourceforge.net/svnroot/ultrastardx/trunk/src/base/USingNotes.pas $ + * $Id: USingNotes.pas 1406 2008-09-23 21:43:52Z k-m_schindler $ + *} + +unit UBeatTimer; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses + UTime; + +type + (** + * TLyricsState contains all information concerning the + * state of the lyrics, e.g. the current beat or duration of the lyrics. + *) + TLyricsState = class + private + Timer: TRelativeTimer; // keeps track of the current time + public + OldBeat: integer; // previous discovered beat + CurrentBeat: integer; // current beat (rounded) + MidBeat: real; // current beat (float) + + // now we use this for super synchronization! + // only used when analyzing voice + // TODO: change ...D to ...Detect(ed) + OldBeatD: integer; // previous discovered beat + CurrentBeatD: integer; // current discovered beat (rounded) + MidBeatD: real; // current discovered beat (float) + + // we use this for audible clicks + // TODO: Change ...C to ...Click + OldBeatC: integer; // previous discovered beat + CurrentBeatC: integer; + MidBeatC: real; // like CurrentBeatC + + OldLine: integer; // previous displayed sentence + + StartTime: real; // time till start of lyrics (= Gap) + TotalTime: real; // total song time + + constructor Create(); + procedure Pause(); + procedure Resume(); + + procedure Reset(); + procedure UpdateBeats(); + + (** + * current song time (in seconds) used as base-timer for lyrics etc. + *) + function GetCurrentTime(): real; + procedure SetCurrentTime(Time: real); + end; + +implementation +uses UNote, Math; + + +constructor TLyricsState.Create(); +begin + // create a triggered timer, so we can Pause() it, set the time + // and Resume() it afterwards for better synching. + Timer := TRelativeTimer.Create(true); + + // reset state + Reset(); +end; + +procedure TLyricsState.Pause(); +begin + Timer.Pause(); +end; + +procedure TLyricsState.Resume(); +begin + Timer.Resume(); +end; + +procedure TLyricsState.SetCurrentTime(Time: real); +begin + // do not start the timer (if not started already), + // after setting the current time + Timer.SetTime(Time, false); +end; + +function TLyricsState.GetCurrentTime(): real; +begin + Result := Timer.GetTime(); +end; + +(** + * Resets the timer and state of the lyrics. + * The timer will be stopped afterwards so you have to call Resume() + * to start the lyrics timer. + *) +procedure TLyricsState.Reset(); +begin + Pause(); + SetCurrentTime(0); + + StartTime := 0; + TotalTime := 0; + + OldBeat := -1; + MidBeat := -1; + CurrentBeat := -1; + + OldBeatC := -1; + MidBeatC := -1; + CurrentBeatC := -1; + + OldBeatD := -1; + MidBeatD := -1; + CurrentBeatD := -1; +end; + +(** + * Updates the beat information (CurrentBeat/MidBeat/...) according to the + * current lyric time. + *) +procedure TLyricsState.UpdateBeats(); +var + CurLyricsTime: real; +begin + CurLyricsTime := GetCurrentTime(); + + OldBeat := CurrentBeat; + MidBeat := GetMidBeat(CurLyricsTime - StartTime / 1000); + CurrentBeat := Floor(MidBeat); + + OldBeatC := CurrentBeatC; + MidBeatC := GetMidBeat(CurLyricsTime - StartTime / 1000); + CurrentBeatC := Floor(MidBeatC); + + OldBeatD := CurrentBeatD; + // MidBeatD = MidBeat with additional GAP + MidBeatD := -0.5 + GetMidBeat(CurLyricsTime - (StartTime + 120 + 20) / 1000); + CurrentBeatD := Floor(MidBeatD); +end; + +end. \ No newline at end of file diff --git a/cmake/src/base/UCommon.pas b/cmake/src/base/UCommon.pas index a52349c0..d729b6dd 100644 --- a/cmake/src/base/UCommon.pas +++ b/cmake/src/base/UCommon.pas @@ -44,28 +44,28 @@ uses ULog; type - TMessageType = ( mtInfo, mtError ); + TMessageType = (mtInfo, mtError); -procedure ShowMessage( const msg : String; msgType: TMessageType = mtInfo ); +procedure ShowMessage(const msg: string; msgType: TMessageType = mtInfo); procedure ConsoleWriteLn(const msg: string); function RWopsFromStream(Stream: TStream): PSDL_RWops; {$IFDEF FPC} -function RandomRange(aMin: Integer; aMax: Integer) : Integer; +function RandomRange(aMin: integer; aMax: integer): integer; {$ENDIF} -function StringReplaceW(text : WideString; search, rep: WideChar):WideString; -function AdaptFilePaths( const aPath : widestring ): widestring; +function StringReplaceW(text: WideString; search, rep: WideChar): WideString; +function AdaptFilePaths(const aPath: WideString): WideString; procedure DisableFloatingPointExceptions(); procedure SetDefaultNumericLocale(); procedure RestoreNumericLocale(); {$IFNDEF MSWINDOWS} - procedure ZeroMemory( Destination: Pointer; Length: DWORD ); - function MakeLong(a, b: Word): Longint; + procedure ZeroMemory(Destination: pointer; Length: dword); + function MakeLong(a, b: word): longint; (* #define LOBYTE(a) (BYTE)(a) #define HIBYTE(a) (BYTE)((a)>>8) @@ -90,8 +90,8 @@ function IsControlChar(ch: WideChar): boolean; // A stable alternative to TList.Sort() (use TList.Sort() if applicable, see below) procedure MergeSort(List: TList; CompareFunc: TListSortCompare); -function GetAlignedMem(Size: cardinal; Alignment: integer): Pointer; -procedure FreeAlignedMem(P: Pointer); +function GetAlignedMem(Size: cardinal; Alignment: integer): pointer; +procedure FreeAlignedMem(P: pointer); implementation @@ -224,10 +224,10 @@ begin exOverflow, exUnderflow, exPrecision]); end; -function StringReplaceW(text : WideString; search, rep: WideChar) : WideString; +function StringReplaceW(text: WideString; search, rep: WideChar): WideString; var - iPos : integer; -// sTemp : WideString; + iPos: integer; +// sTemp: WideString; begin (* result := text; @@ -251,25 +251,25 @@ begin end; end; -function AdaptFilePaths( const aPath : widestring ): widestring; +function AdaptFilePaths(const aPath: WideString): WideString; begin - result := StringReplaceW( aPath, '\', PathDelim );//, [rfReplaceAll] ); + result := StringReplaceW(aPath, '\', PathDelim);//, [rfReplaceAll]); end; {$IFNDEF MSWINDOWS} -procedure ZeroMemory( Destination: Pointer; Length: DWORD ); +procedure ZeroMemory(Destination: pointer; Length: dword); begin - FillChar( Destination^, Length, 0 ); + FillChar(Destination^, Length, 0); end; -function MakeLong(A, B: Word): Longint; +function MakeLong(A, B: word): longint; begin Result := (LongInt(B) shl 16) + A; end; (* -function QueryPerformanceCounter(lpPerformanceCount:TLARGEINTEGER):Bool; +function QueryPerformanceCounter(lpPerformanceCount:TLARGEINTEGER): Bool; // From http://en.wikipedia.org/wiki/RDTSC function RDTSC: Int64; register; @@ -310,7 +310,7 @@ begin Result := false; FilePath := ExtractFilePath(FileName); - if (FindFirst(FilePath+'*', faAnyFile, SearchInfo) = 0) then + if (FindFirst(FilePath + '*', faAnyFile, SearchInfo) = 0) then begin LocalFileName := ExtractFileName(FileName); repeat @@ -330,14 +330,14 @@ begin end; // +++++++++++++++++++++ helpers for RWOpsFromStream() +++++++++++++++ -function SdlStreamSeek( context : PSDL_RWops; offset : Integer; whence : Integer ) : integer; cdecl; +function SdlStreamSeek(context: PSDL_RWops; offset: integer; whence: integer): integer; cdecl; var - stream : TStream; - origin : Word; + stream: TStream; + origin: word; begin - stream := TStream( context.unknown ); - if ( stream = nil ) then - raise EInvalidContainer.Create( 'SDLStreamSeek on nil' ); + stream := TStream(context.unknown); + if (stream = nil) then + raise EInvalidContainer.Create('SDLStreamSeek on nil'); case whence of 0 : origin := soFromBeginning; // Offset is from the beginning of the resource. Seek moves to the position Offset. Offset must be >= 0. 1 : origin := soFromCurrent; // Offset is from the current position in the resource. Seek moves to Position + Offset. @@ -345,30 +345,30 @@ begin else origin := soFromBeginning; // just in case end; - Result := stream.Seek( offset, origin ); + Result := stream.Seek(offset, origin); end; -function SdlStreamRead( context : PSDL_RWops; Ptr : Pointer; size : Integer; maxnum: Integer ) : Integer; cdecl; +function SdlStreamRead(context: PSDL_RWops; Ptr: pointer; size: integer; maxnum: integer): integer; cdecl; var - stream : TStream; + stream: TStream; begin - stream := TStream( context.unknown ); - if ( stream = nil ) then - raise EInvalidContainer.Create( 'SDLStreamRead on nil' ); + stream := TStream(context.unknown); + if (stream = nil) then + raise EInvalidContainer.Create('SDLStreamRead on nil'); try - Result := stream.read( Ptr^, Size * maxnum ) div size; + Result := stream.read(Ptr^, Size * maxnum) div size; except Result := -1; end; end; -function SDLStreamClose( context : PSDL_RWops ) : Integer; cdecl; +function SDLStreamClose(context: PSDL_RWops): integer; cdecl; var - stream : TStream; + stream: TStream; begin - stream := TStream( context.unknown ); - if ( stream = nil ) then - raise EInvalidContainer.Create( 'SDLStreamClose on nil' ); + stream := TStream(context.unknown); + if (stream = nil) then + raise EInvalidContainer.Create('SDLStreamClose on nil'); stream.Free; Result := 1; end; @@ -397,12 +397,10 @@ begin end; end; - - {$IFDEF FPC} -function RandomRange(aMin: Integer; aMax: Integer) : Integer; +function RandomRange(aMin: integer; aMax: integer): integer; begin - RandomRange := Random(aMax-aMin) + aMin ; + RandomRange := Random(aMax - aMin) + aMin ; end; {$ENDIF} @@ -455,7 +453,7 @@ begin System.EnterCriticalSection(ConsoleCriticalSection); // output pending messages - for i := 0 to MessageList.Count-1 do + for i := 0 to MessageList.Count - 1 do begin _ConsoleWriteLn(MessageList[i]); end; @@ -528,7 +526,7 @@ end; procedure ShowMessage(const msg: String; msgType: TMessageType); {$IFDEF MSWINDOWS} -var Flags: Cardinal; +var Flags: cardinal; {$ENDIF} begin {$IF Defined(MSWINDOWS)} @@ -607,7 +605,7 @@ procedure _MergeSort(InList, TempList, OutList: TList; StartPos, BlockSize: inte CompareFunc: TListSortCompare); var LeftSize, RightSize: integer; // number of elements in left/right block - LeftEnd, RightEnd: integer; // Index after last element in left/right block + LeftEnd, RightEnd: integer; // Index after last element in left/right block MidPos: integer; // index of first element in right block Pos: integer; // position in output list begin @@ -683,7 +681,7 @@ end; type // stores the unaligned pointer of data allocated by GetAlignedMem() PMemAlignHeader = ^TMemAlignHeader; - TMemAlignHeader = Pointer; + TMemAlignHeader = pointer; (** * Use this function to assure that allocated memory is aligned on a specific @@ -699,9 +697,9 @@ type * alignments on 16 and 32 byte boundaries too. *) {$WARNINGS OFF} -function GetAlignedMem(Size: cardinal; Alignment: integer): Pointer; +function GetAlignedMem(Size: cardinal; Alignment: integer): pointer; var - OrigPtr: Pointer; + OrigPtr: pointer; const MIN_ALIGNMENT = 16; begin @@ -722,9 +720,9 @@ begin end; // reserve space for the header - Result := Pointer(PtrUInt(OrigPtr) + SizeOf(TMemAlignHeader)); + Result := pointer(PtrUInt(OrigPtr) + SizeOf(TMemAlignHeader)); // align memory - Result := Pointer(PtrUInt(Result) + Alignment - PtrUInt(Result) mod Alignment); + Result := pointer(PtrUInt(Result) + Alignment - PtrUInt(Result) mod Alignment); // set header with info on old pointer for FreeMem PMemAlignHeader(PtrUInt(Result) - SizeOf(TMemAlignHeader))^ := OrigPtr; @@ -732,7 +730,7 @@ end; {$WARNINGS ON} {$WARNINGS OFF} -procedure FreeAlignedMem(P: Pointer); +procedure FreeAlignedMem(P: pointer); begin if (P <> nil) then FreeMem(PMemAlignHeader(PtrUInt(P) - SizeOf(TMemAlignHeader))^); diff --git a/cmake/src/base/UDraw.pas b/cmake/src/base/UDraw.pas index 8a66d271..1783986f 100644 --- a/cmake/src/base/UDraw.pas +++ b/cmake/src/base/UDraw.pas @@ -638,7 +638,7 @@ begin // determine lyric help bar position and size Bounds.Left := MoveStartX + BarProgress * MoveDist; Bounds.Right := Bounds.Left + BarWidth; - Bounds.Top := Skin_LyricsT + 3; + Bounds.Top := Theme.LyricBar.IndicatorYOffset + Theme.LyricBar.UpperY ; Bounds.Bottom := Bounds.Top + BarHeight + 3; // draw lyric help bar diff --git a/cmake/src/base/UGraphic.pas b/cmake/src/base/UGraphic.pas index 17175d02..818e49aa 100644 --- a/cmake/src/base/UGraphic.pas +++ b/cmake/src/base/UGraphic.pas @@ -198,7 +198,14 @@ var Tex_Score_NoteBarRound_Lightest : array [1..6] of TTexture; Tex_Score_Ratings : array [0..7] of TTexture; - + + // arrows for SelectSlide + Tex_SelectS_ArrowL: TTexture; + Tex_SelectS_ArrowR: TTexture; + + // textures for software mouse cursor + Tex_Cursor_Unpressed: TTexture; + Tex_Cursor_Pressed: TTexture; const Skin_BGColorR = 1; Skin_BGColorG = 1; @@ -232,17 +239,6 @@ const Skin_OscG = 0; Skin_OscB = 0; - // TODO: add to theme ini file - Skin_LyricsT = 493; - Skin_LyricsUpperX = 80; - Skin_LyricsUpperW = 640; - Skin_LyricsUpperY = Skin_LyricsT; - Skin_LyricsUpperH = 41; - Skin_LyricsLowerX = 80; - Skin_LyricsLowerW = 640; - Skin_LyricsLowerY = Skin_LyricsT + Skin_LyricsUpperH + 1; - Skin_LyricsLowerH = 41; - Skin_SpectrumT = 470; Skin_SpectrumBot = 570; Skin_SpectrumH = 100; @@ -339,6 +335,15 @@ begin Tex_Ball := Texture.LoadTexture(Skin.GetTextureFileName('Ball'), TEXTURE_TYPE_TRANSPARENT, $FF00FF); Tex_Lyric_Help_Bar := Texture.LoadTexture(Skin.GetTextureFileName('LyricHelpBar'), TEXTURE_TYPE_TRANSPARENT, $FF00FF); + Tex_SelectS_ArrowL := Texture.LoadTexture(Skin.GetTextureFileName('Select_ArrowLeft'), TEXTURE_TYPE_TRANSPARENT, 0); + Tex_SelectS_ArrowR := Texture.LoadTexture(Skin.GetTextureFileName('Select_ArrowRight'), TEXTURE_TYPE_TRANSPARENT, 0); + + Tex_Cursor_Unpressed := Texture.LoadTexture(Skin.GetTextureFileName('Cursor'), TEXTURE_TYPE_TRANSPARENT, 0); + + if (Skin.GetTextureFileName('Cursor_Pressed') <> '') then + Tex_Cursor_Pressed := Texture.LoadTexture(Skin.GetTextureFileName('Cursor_Pressed'), TEXTURE_TYPE_TRANSPARENT, 0) + else + Tex_Cursor_Pressed.TexNum := 0; //TimeBar mod Tex_TimeProgress := Texture.LoadTexture(Skin.GetTextureFileName('TimeBar')); @@ -497,6 +502,7 @@ begin Log.LogStatus('TDisplay.Create', 'UGraphic.Initialize3D'); Display := TDisplay.Create; + //Display.SetCursor; //Log.BenchmarkEnd(2); Log.LogBenchmark('====> Creating Display', 2); @@ -629,15 +635,15 @@ begin begin Log.LogStatus('SDL_SetVideoMode', 'Set Video Mode... Full Screen'); screen := SDL_SetVideoMode(W, H, (Depth+1) * 16, SDL_OPENGL or SDL_FULLSCREEN ); - SDL_ShowCursor(0); end else begin Log.LogStatus('SDL_SetVideoMode', 'Set Video Mode... Windowed'); screen := SDL_SetVideoMode(W, H, 0, SDL_OPENGL or SDL_RESIZABLE); - SDL_ShowCursor(1); end; + SDL_ShowCursor(0); + if (screen = nil) then begin Log.LogCritical('SDL_SetVideoMode Failed', 'Initialize3D'); diff --git a/cmake/src/base/UImage.pas b/cmake/src/base/UImage.pas index 8dc38495..60b0a3a2 100644 --- a/cmake/src/base/UImage.pas +++ b/cmake/src/base/UImage.pas @@ -311,13 +311,13 @@ var hour, minute, second, msecond: word; begin DecodeDate(time, year, month, day); - pngTime.year := year; - pngTime.month := month; - pngTime.day := day; + pngTime.year := png_uint_16(year); + pngTime.month := png_byte(month); + pngTime.day := png_byte(day); DecodeTime(time, hour, minute, second, msecond); - pngTime.hour := hour; - pngTime.minute := minute; - pngTime.second := second; + pngTime.hour := png_byte(hour); + pngTime.minute := png_byte(minute); + pngTime.second := png_byte(second); end; (* @@ -896,8 +896,13 @@ procedure ColorizeImage(ImgSurface: PSDL_Surface; NewColor: cardinal); // replaced by division of longwords, shifted by 10 bits to keep // digits. + // The use of longwards leeds to some type size mismatch warnings + // whenever differences are formed. + // This should not be a problem, since the results should all be positive. + // replacing longword by longint would probably resolve this cosmetic fault :-) + function ColorToHue(const Color: longword): longword; - // returns hue within the range [0.0-6.0] but shl 10, ie. times 1024 + // returns hue within the range [0.0-6.0] but shl 10, ie. times 1024 var Red, Green, Blue: longword; Min, Max, Delta: longword; @@ -919,7 +924,8 @@ procedure ColorizeImage(ImgSurface: PSDL_Surface; NewColor: cardinal); if Blue > Max then Max := Blue; // calc hue - Delta := Max - Min; + Delta := Max - Min; // This gives a type size mismatch warning, because Delta is longword, ie. >= 0 + // But the assignments above are easy enough to be sure, that Max - Min is >= 0. if (Delta = 0) then Result := 0 else @@ -1023,16 +1029,19 @@ begin end else // all colors except black and white begin - Delta := Max - Min; + Delta := Max - Min; // This gives a type size mismatch warning, because Delta is longword, ie. >= 0 + // But the assignments above are easy enough to be sure, that Max - Min is >= 0. Sat := (Delta shl 10) div Max; // shl 10 - // shr 10 corrects that sat and f are shl 10 + // shr 10 corrects that Sat and f are shl 10 // the resulting p, q and t are unshifted p := (Max*(1024-Sat)) shr 10; q := (Max*(1024-(Sat*f) shr 10)) shr 10; t := (Max*(1024-(Sat*(1024-f)) shr 10)) shr 10; + // The above 3 lines give type size mismatch warning, but all variables are longword and the ranges should be ok. + case HueInteger of 0: begin Red := Max; Green := t; Blue := p; end; // (v,t,p) 1: begin Red := q; Green := Max; Blue := p; end; // (q,v,p) @@ -1043,13 +1052,13 @@ begin end; {$IFDEF FPC_BIG_ENDIAN} - PixelColors[3] := Red; - PixelColors[2] := Green; - PixelColors[1] := Blue + PixelColors[3] := byte(Red); + PixelColors[2] := byte(Green); + PixelColors[1] := byte(Blue); {$ELSE} - PixelColors[0] := Red; - PixelColors[1] := Green; - PixelColors[2] := Blue; + PixelColors[0] := byte(Red); + PixelColors[1] := byte(Green); + PixelColors[2] := byte(Blue); {$ENDIF} end; diff --git a/cmake/src/base/UIni.pas b/cmake/src/base/UIni.pas index 2c1029f6..2bcc7305 100644 --- a/cmake/src/base/UIni.pas +++ b/cmake/src/base/UIni.pas @@ -77,6 +77,7 @@ type function ReadArrayIndex(const SearchArray: array of string; IniFile: TCustomIniFile; IniSection: string; IniProperty: string; Default: integer): integer; + procedure TranslateOptionValues; procedure LoadInputDeviceCfg(IniFile: TMemIniFile); procedure SaveInputDeviceCfg(IniFile: TIniFile); procedure LoadThemes(IniFile: TCustomIniFile); @@ -154,6 +155,7 @@ type // Controller Joypad: integer; + Mouse: integer; procedure Load(); procedure Save(); @@ -200,8 +202,7 @@ const ISingWindow: array[0..1] of string = ('Small', 'Big'); //SingBar Mod - IOscilloscope: array[0..2] of string = ('Off', 'Osci', 'Bar'); -//IOscilloscope: array[0..1] of string = ('Off', 'On'); + IOscilloscope: array[0..1] of string = ('Off', 'On'); ISpectrum: array[0..1] of string = ('Off', 'On'); ISpectrograph: array[0..1] of string = ('Off', 'On'); @@ -242,15 +243,75 @@ const IScreenFade: array[0..1] of string = ('Off', 'On'); IAskbeforeDel: array[0..1] of string = ('Off', 'On'); IOnSongClick: array[0..2] of string = ('Sing', 'Select Players', 'Open Menu'); - ILineBonus: array[0..2] of string = ('Off', 'At Score', 'At Notes'); + ILineBonus: array[0..1] of string = ('Off', 'On'); IPartyPopup: array[0..1] of string = ('Off', 'On'); IJoypad: array[0..1] of string = ('Off', 'On'); + IMouse: array[0..2] of string = ('Off', 'Hardware Cursor', 'Software Cursor'); // Recording options IChannelPlayer: array[0..6] of string = ('Off', '1', '2', '3', '4', '5', '6'); IMicBoost: array[0..3] of string = ('Off', '+6dB', '+12dB', '+18dB'); +var + IDifficultyTranslated: array[0..2] of string = ('Easy', 'Medium', 'Hard'); + ITabsTranslated: array[0..1] of string = ('Off', 'On'); + + ISortingTranslated: array[0..7] of string = ('Edition', 'Genre', 'Language', 'Folder', 'Title', 'Artist', 'Title2', 'Artist2'); + + IDebugTranslated: array[0..1] of string = ('Off', 'On'); + + IFullScreenTranslated: array[0..1] of string = ('Off', 'On'); + IVisualizerTranslated: array[0..2] of string = ('Off', 'WhenNoVideo','On'); + + IBackgroundMusicTranslated: array[0..1] of string = ('Off', 'On'); + ISingWindowTranslated: array[0..1] of string = ('Small', 'Big'); + + //SingBar Mod + IOscilloscopeTranslated: array[0..1] of string = ('Off', 'On'); + + ISpectrumTranslated: array[0..1] of string = ('Off', 'On'); + ISpectrographTranslated: array[0..1] of string = ('Off', 'On'); + IMovieSizeTranslated: array[0..2] of string = ('Half', 'Full [Vid]', 'Full [BG+Vid]'); + + IClickAssistTranslated: array[0..1] of string = ('Off', 'On'); + IBeatClickTranslated: array[0..1] of string = ('Off', 'On'); + ISavePlaybackTranslated: array[0..1] of string = ('Off', 'On'); + + IVoicePassthroughTranslated: array[0..1] of string = ('Off', 'On'); + + //Song Preview + IPreviewVolumeTranslated: array[0..10] of string = ('Off', '10%', '20%', '30%', '40%', '50%', '60%', '70%', '80%', '90%', '100%'); + + IAudioOutputBufferSizeTranslated: array[0..9] of string = ('Auto', '256', '512', '1024', '2048', '4096', '8192', '16384', '32768', '65536'); + + IAudioInputBufferSizeTranslated: array[0..9] of string = ('Auto', '256', '512', '1024', '2048', '4096', '8192', '16384', '32768', '65536'); + + IPreviewFadingTranslated: array[0..5] of string = ('Off', '1 Sec', '2 Secs', '3 Secs', '4 Secs', '5 Secs'); + + ILyricsFontTranslated: array[0..2] of string = ('Plain', 'OLine1', 'OLine2'); + ILyricsEffectTranslated: array[0..4] of string = ('Simple', 'Zoom', 'Slide', 'Ball', 'Shift'); + ISolmizationTranslated: array[0..3] of string = ('Off', 'Euro', 'Jap', 'American'); + INoteLinesTranslated: array[0..1] of string = ('Off', 'On'); + + IColorTranslated: array[0..8] of string = ('Blue', 'Green', 'Pink', 'Red', 'Violet', 'Orange', 'Yellow', 'Brown', 'Black'); + + // Advanced + ILoadAnimationTranslated: array[0..1] of string = ('Off', 'On'); + IEffectSingTranslated: array[0..1] of string = ('Off', 'On'); + IScreenFadeTranslated: array[0..1] of string = ('Off', 'On'); + IAskbeforeDelTranslated: array[0..1] of string = ('Off', 'On'); + IOnSongClickTranslated: array[0..2] of string = ('Sing', 'Select Players', 'Open Menu'); + ILineBonusTranslated: array[0..1] of string = ('Off', 'On'); + IPartyPopupTranslated: array[0..1] of string = ('Off', 'On'); + + IJoypadTranslated: array[0..1] of string = ('Off', 'On'); + IMouseTranslated: array[0..2] of string = ('Off', 'Hardware Cursor', 'Software Cursor'); + + // Recording options + IChannelPlayerTranslated: array[0..6] of string = ('Off', '1', '2', '3', '4', '5', '6'); + IMicBoostTranslated: array[0..3] of string = ('Off', '+6dB', '+12dB', '+18dB'); + implementation uses @@ -264,6 +325,188 @@ uses UCommandLine, UPath; +(** + * Translate and set the values of options, which need translation. + *) +procedure TIni.TranslateOptionValues; +begin + ULanguage.Language.ChangeLanguage(ILanguage[Language]); + + IDifficultyTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_EASY'); + IDifficultyTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_MEDIUM'); + IDifficultyTranslated[2] := ULanguage.Language.Translate('OPTION_VALUE_HARD'); + + ITabsTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); + ITabsTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON'); + + ISortingTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_EDITION'); + ISortingTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_GENRE'); + ISortingTranslated[2] := ULanguage.Language.Translate('OPTION_VALUE_LANGUAGE'); + ISortingTranslated[3] := ULanguage.Language.Translate('OPTION_VALUE_FOLDER'); + ISortingTranslated[4] := ULanguage.Language.Translate('OPTION_VALUE_TITLE'); + ISortingTranslated[5] := ULanguage.Language.Translate('OPTION_VALUE_ARTIST'); + ISortingTranslated[6] := ULanguage.Language.Translate('OPTION_VALUE_TITLE2'); + ISortingTranslated[7] := ULanguage.Language.Translate('OPTION_VALUE_ARTIST2'); + + IDebugTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); + IDebugTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON'); + + IFullScreenTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); + IFullScreenTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON'); + + IVisualizerTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); + IVisualizerTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_WHENNOVIDEO'); + IVisualizerTranslated[2] := ULanguage.Language.Translate('OPTION_VALUE_ON'); + + IBackgroundMusicTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); + IBackgroundMusicTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON'); + + ISingWindowTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_SMALL'); + ISingWindowTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_BIG'); + + IOscilloscopeTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); + IOscilloscopeTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON'); + + ISpectrumTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); + ISpectrumTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON'); + + ISpectrographTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); + ISpectrographTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON'); + + IMovieSizeTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_HALF'); + IMovieSizeTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_FULL_VID'); + IMovieSizeTranslated[2] := ULanguage.Language.Translate('OPTION_VALUE_FULL_VID_BG'); + + IClickAssistTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); + IClickAssistTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON'); + + IBeatClickTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); + IBeatClickTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON'); + + ISavePlaybackTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); + ISavePlaybackTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON'); + + IVoicePassthroughTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); + IVoicePassthroughTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON'); + + ILyricsFontTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_PLAIN'); + ILyricsFontTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_OLINE1'); + ILyricsFontTranslated[2] := ULanguage.Language.Translate('OPTION_VALUE_OLINE2'); + + ILyricsEffectTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_SIMPLE'); + ILyricsEffectTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ZOOM'); + ILyricsEffectTranslated[2] := ULanguage.Language.Translate('OPTION_VALUE_SLIDE'); + ILyricsEffectTranslated[3] := ULanguage.Language.Translate('OPTION_VALUE_BALL'); + ILyricsEffectTranslated[4] := ULanguage.Language.Translate('OPTION_VALUE_SHIFT'); + + ISolmizationTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); + ISolmizationTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_EURO'); + ISolmizationTranslated[2] := ULanguage.Language.Translate('OPTION_VALUE_JAPAN'); + ISolmizationTranslated[3] := ULanguage.Language.Translate('OPTION_VALUE_AMERICAN'); + + INoteLinesTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); + INoteLinesTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON'); + + IColorTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_BLUE'); + IColorTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_GREEN'); + IColorTranslated[2] := ULanguage.Language.Translate('OPTION_VALUE_PINK'); + IColorTranslated[3] := ULanguage.Language.Translate('OPTION_VALUE_RED'); + IColorTranslated[4] := ULanguage.Language.Translate('OPTION_VALUE_VIOLET'); + IColorTranslated[5] := ULanguage.Language.Translate('OPTION_VALUE_ORANGE'); + IColorTranslated[6] := ULanguage.Language.Translate('OPTION_VALUE_YELLOW'); + IColorTranslated[7] := ULanguage.Language.Translate('OPTION_VALUE_BROWN'); + IColorTranslated[8] := ULanguage.Language.Translate('OPTION_VALUE_BALCK'); + + // Advanced + ILoadAnimationTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); + ILoadAnimationTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON'); + + IEffectSingTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); + IEffectSingTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON'); + + IScreenFadeTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); + IScreenFadeTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON'); + + IAskbeforeDelTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); + IAskbeforeDelTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON'); + + IOnSongClickTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_SING'); + IOnSongClickTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_SELECT_PLAYERS'); + IOnSongClickTranslated[2] := ULanguage.Language.Translate('OPTION_VALUE_OPEN_MENU'); + + ILineBonusTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); + ILineBonusTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON'); + + IPartyPopupTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); + IPartyPopupTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON'); + + IJoypadTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); + IJoypadTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON'); + + IMouseTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); + IMouseTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_HARDWARE_CURSOR'); + IMouseTranslated[2] := ULanguage.Language.Translate('OPTION_VALUE_SOFTWARE_CURSOR'); + + IAudioOutputBufferSizeTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_AUTO'); + IAudioOutputBufferSizeTranslated[1] := '256'; + IAudioOutputBufferSizeTranslated[2] := '512'; + IAudioOutputBufferSizeTranslated[3] := '1024'; + IAudioOutputBufferSizeTranslated[4] := '2048'; + IAudioOutputBufferSizeTranslated[5] := '4096'; + IAudioOutputBufferSizeTranslated[6] := '8192'; + IAudioOutputBufferSizeTranslated[7] := '16384'; + IAudioOutputBufferSizeTranslated[8] := '32768'; + IAudioOutputBufferSizeTranslated[9] := '65536'; + + + IAudioInputBufferSizeTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_AUTO'); + IAudioInputBufferSizeTranslated[1] := '256'; + IAudioInputBufferSizeTranslated[2] := '512'; + IAudioInputBufferSizeTranslated[3] := '1024'; + IAudioInputBufferSizeTranslated[4] := '2048'; + IAudioInputBufferSizeTranslated[5] := '4096'; + IAudioInputBufferSizeTranslated[6] := '8192'; + IAudioInputBufferSizeTranslated[7] := '16384'; + IAudioInputBufferSizeTranslated[8] := '32768'; + IAudioInputBufferSizeTranslated[9] := '65536'; + + //Song Preview + IPreviewVolumeTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); + IPreviewVolumeTranslated[1] := '10%'; + IPreviewVolumeTranslated[2] := '20%'; + IPreviewVolumeTranslated[3] := '30%'; + IPreviewVolumeTranslated[4] := '40%'; + IPreviewVolumeTranslated[5] := '50%'; + IPreviewVolumeTranslated[6] := '60%'; + IPreviewVolumeTranslated[7] := '70%'; + IPreviewVolumeTranslated[8] := '80%'; + IPreviewVolumeTranslated[9] := '90%'; + IPreviewVolumeTranslated[10] := '100%'; + + + IPreviewFadingTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); + IPreviewFadingTranslated[1] := '1 ' + ULanguage.Language.Translate('OPTION_VALUE_SEC'); + IPreviewFadingTranslated[2] := '2 ' + ULanguage.Language.Translate('OPTION_VALUE_SECS'); + IPreviewFadingTranslated[3] := '3 ' + ULanguage.Language.Translate('OPTION_VALUE_SECS'); + IPreviewFadingTranslated[4] := '4 ' + ULanguage.Language.Translate('OPTION_VALUE_SECS'); + IPreviewFadingTranslated[5] := '5 ' + ULanguage.Language.Translate('OPTION_VALUE_SECS'); + + // Recording options + IChannelPlayerTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); + IChannelPlayerTranslated[1] := '1'; + IChannelPlayerTranslated[2] := '2'; + IChannelPlayerTranslated[3] := '3'; + IChannelPlayerTranslated[4] := '4'; + IChannelPlayerTranslated[5] := '5'; + IChannelPlayerTranslated[6] := '6'; + + IMicBoostTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); + IMicBoostTranslated[1] := '+6dB'; + IMicBoostTranslated[2] := '+12dB'; + IMicBoostTranslated[3] := '+18dB'; + +end; + (** * Returns the filename without its fileextension *) @@ -588,6 +831,7 @@ begin end; // reverse order + Log.LogStatus( 'Log size of resolution: ' + IntToStr(Length(IResolution)), 'Video'); for I := 0 to (Length(IResolution) div 2) - 1 do begin swap(IResolution[I], IResolution[High(IResolution)-I]); @@ -681,7 +925,7 @@ begin SingWindow := GetArrayIndex(ISingWindow, IniFile.ReadString('Graphics', 'SingWindow', 'Big')); // Oscilloscope - Oscilloscope := GetArrayIndex(IOscilloscope, IniFile.ReadString('Graphics', 'Oscilloscope', 'Bar')); + Oscilloscope := GetArrayIndex(IOscilloscope, IniFile.ReadString('Graphics', 'Oscilloscope', IOscilloscope[0])); // Spectrum Spectrum := GetArrayIndex(ISpectrum, IniFile.ReadString('Graphics', 'Spectrum', 'Off')); @@ -761,7 +1005,7 @@ begin OnSongClick := GetArrayIndex(IOnSongClick, IniFile.ReadString('Advanced', 'OnSongClick', 'Sing')); // Linebonus - LineBonus := GetArrayIndex(ILineBonus, IniFile.ReadString('Advanced', 'LineBonus', 'At Score')); + LineBonus := GetArrayIndex(ILineBonus, IniFile.ReadString('Advanced', 'LineBonus', ILineBonus[1])); // PartyPopup PartyPopup := GetArrayIndex(IPartyPopup, IniFile.ReadString('Advanced', 'PartyPopup', 'On')); @@ -769,8 +1013,13 @@ begin // Joypad Joypad := GetArrayIndex(IJoypad, IniFile.ReadString('Controller', 'Joypad', IJoypad[0])); + // Mouse + Mouse := GetArrayIndex(IMouse, IniFile.ReadString('Controller', 'Mouse', IMouse[2])); + LoadPaths(IniFile); + TranslateOptionValues; + IniFile.Free; end; @@ -908,6 +1157,9 @@ begin // Joypad IniFile.WriteString('Controller', 'Joypad', IJoypad[Joypad]); + // Mouse + IniFile.WriteString('Controller', 'Mouse', IMouse[Mouse]); + // Directories (add a template if section is missing) // Note: Value must be ' ' and not '', otherwise no key is generated on Linux if (not IniFile.SectionExists('Directories')) then diff --git a/cmake/src/base/UMain.pas b/cmake/src/base/UMain.pas index 469a658b..275510fc 100644 --- a/cmake/src/base/UMain.pas +++ b/cmake/src/base/UMain.pas @@ -83,6 +83,7 @@ uses UPath, UPlaylist, UMusic, + UBeatTimer, UPlatform, USkins, USongs, @@ -358,9 +359,11 @@ begin CountMidTime; Delay := Floor(1000 / MAX_FPS - 1000 * TimeMid); + Log.LogError ('MainLoop', 'Delay: ' + intToStr(Delay)); if Delay >= 1 then SDL_Delay(Delay); // dynamic, maximum is 100 fps + Log.LogError ('MainLoop', 'Delay: ok ' + intToStr(Delay)); CountSkipTime; @@ -374,9 +377,26 @@ begin end; end; +procedure DoQuit; +begin + // if question option is enabled then show exit popup + if (Ini.AskbeforeDel = 1) then + begin + Display.CurrentScreen^.CheckFadeTo(nil,'MSG_QUIT_USDX'); + end + else // if ask-for-exit is disabled then simply exit + begin + Display.Fade := 0; + Display.NextScreenWithCheck := nil; + Display.CheckOK := true; + end; +end; + procedure CheckEvents; var - Event: TSDL_event; + Event: TSDL_event; + mouseDown: boolean; + mouseBtn: integer; begin if Assigned(Display.NextScreen) then Exit; @@ -390,17 +410,46 @@ begin Display.NextScreenWithCheck := nil; Display.CheckOK := true; end; - SDL_MOUSEBUTTONDOWN: + + SDL_MOUSEMOTION, SDL_MOUSEBUTTONDOWN, SDL_MOUSEBUTTONUP: begin -{ - with Event.button do + if (Ini.Mouse > 0) then begin - if State = SDL_BUTTON_LEFT then + case Event.type_ of + SDL_MOUSEMOTION: + begin + mouseDown := false; + mouseBtn := 0; + end; + SDL_MOUSEBUTTONDOWN: + begin + mouseDown := true; + mouseBtn := Event.button.button; + end; + SDL_MOUSEBUTTONUP: + begin + mouseDown := false; + mouseBtn := Event.button.button; + end; + end; + + Display.MoveCursor(Event.button.X * 800 / Screen.w, + Event.button.Y * 600 / Screen.h, + mouseDown and ((mouseBtn <> SDL_BUTTON_WHEELDOWN) or (mouseBtn <> SDL_BUTTON_WHEELUP))); + + if (ScreenPopupError <> nil) and (ScreenPopupError.Visible) then + done := not ScreenPopupError.ParseMouse(mouseBtn, mouseDown, Event.button.x, Event.button.y) + else if (ScreenPopupCheck <> nil) and (ScreenPopupCheck.Visible) then + done := not ScreenPopupCheck.ParseMouse(mouseBtn, mouseDown, Event.button.x, Event.button.y) + else begin - // + done := not Display.CurrentScreen^.ParseMouse(mouseBtn, mouseDown, Event.button.x, Event.button.y); + + // if screen wants to exit + if done then + DoQuit; end; end; -} end; SDL_VIDEORESIZE: begin @@ -436,14 +485,14 @@ begin if boolean( Ini.FullScreen ) then begin SDL_SetVideoMode(ScreenW, ScreenH, (Ini.Depth+1) * 16, SDL_OPENGL or SDL_FULLSCREEN); - SDL_ShowCursor(0); end else begin SDL_SetVideoMode(ScreenW, ScreenH, (Ini.Depth+1) * 16, SDL_OPENGL or SDL_RESIZABLE); - SDL_ShowCursor(1); end; + Display.SetCursor; + glViewPort(0, 0, ScreenW, ScreenH); {$IFEND} end @@ -463,19 +512,7 @@ begin // if screen wants to exit if Done then - begin - // if question option is enabled then show exit popup - if (Ini.AskbeforeDel = 1) then - begin - Display.CurrentScreen^.CheckFadeTo(nil,'MSG_QUIT_USDX'); - end - else // if ask-for-exit is disabled then simply exit - begin - Display.Fade := 0; - Display.NextScreenWithCheck := nil; - Display.CheckOK := true; - end; - end; + DoQuit; end; end; diff --git a/cmake/src/base/UMusic.pas b/cmake/src/base/UMusic.pas index b86f3aad..19c54bee 100644 --- a/cmake/src/base/UMusic.pas +++ b/cmake/src/base/UMusic.pas @@ -36,7 +36,8 @@ interface uses UTime, SysUtils, - Classes; + Classes, + UBeatTimer; type TNoteType = (ntFreestyle, ntNormal, ntGolden); @@ -99,51 +100,6 @@ type Line: array of TLine; end; - (** - * TLyricsState contains all information concerning the - * state of the lyrics, e.g. the current beat or duration of the lyrics. - *) - TLyricsState = class - private - Timer: TRelativeTimer; // keeps track of the current time - public - OldBeat: integer; // previous discovered beat - CurrentBeat: integer; // current beat (rounded) - MidBeat: real; // current beat (float) - - // now we use this for super synchronization! - // only used when analyzing voice - // TODO: change ...D to ...Detect(ed) - OldBeatD: integer; // previous discovered beat - CurrentBeatD: integer; // current discovered beat (rounded) - MidBeatD: real; // current discovered beat (float) - - // we use this for audible clicks - // TODO: Change ...C to ...Click - OldBeatC: integer; // previous discovered beat - CurrentBeatC: integer; - MidBeatC: real; // like CurrentBeatC - - OldLine: integer; // previous displayed sentence - - StartTime: real; // time till start of lyrics (= Gap) - TotalTime: real; // total song time - - constructor Create(); - procedure Pause(); - procedure Resume(); - - procedure Reset(); - procedure UpdateBeats(); - - (** - * current song time (in seconds) used as base-timer for lyrics etc. - *) - function GetCurrentTime(): real; - procedure SetCurrentTime(Time: real); - end; - - const FFTSize = 512; // size of FFT data (output: FFTSize/2 values) type @@ -977,92 +933,6 @@ begin end; end; - -{ TVoiceRemoval } - -constructor TLyricsState.Create(); -begin - // create a triggered timer, so we can Pause() it, set the time - // and Resume() it afterwards for better synching. - Timer := TRelativeTimer.Create(true); - - // reset state - Reset(); -end; - -procedure TLyricsState.Pause(); -begin - Timer.Pause(); -end; - -procedure TLyricsState.Resume(); -begin - Timer.Resume(); -end; - -procedure TLyricsState.SetCurrentTime(Time: real); -begin - // do not start the timer (if not started already), - // after setting the current time - Timer.SetTime(Time, false); -end; - -function TLyricsState.GetCurrentTime(): real; -begin - Result := Timer.GetTime(); -end; - -(** - * Resets the timer and state of the lyrics. - * The timer will be stopped afterwards so you have to call Resume() - * to start the lyrics timer. - *) -procedure TLyricsState.Reset(); -begin - Pause(); - SetCurrentTime(0); - - StartTime := 0; - TotalTime := 0; - - OldBeat := -1; - MidBeat := -1; - CurrentBeat := -1; - - OldBeatC := -1; - MidBeatC := -1; - CurrentBeatC := -1; - - OldBeatD := -1; - MidBeatD := -1; - CurrentBeatD := -1; -end; - -(** - * Updates the beat information (CurrentBeat/MidBeat/...) according to the - * current lyric time. - *) -procedure TLyricsState.UpdateBeats(); -var - CurLyricsTime: real; -begin - CurLyricsTime := GetCurrentTime(); - - OldBeat := CurrentBeat; - MidBeat := GetMidBeat(CurLyricsTime - StartTime / 1000); - CurrentBeat := Floor(MidBeat); - - OldBeatC := CurrentBeatC; - MidBeatC := GetMidBeat(CurLyricsTime - StartTime / 1000); - CurrentBeatC := Floor(MidBeatC); - - OldBeatD := CurrentBeatD; - // MidBeatD = MidBeat with additional GAP - MidBeatD := -0.5 + GetMidBeat(CurLyricsTime - (StartTime + 120 + 20) / 1000); - CurrentBeatD := Floor(MidBeatD); -end; - - { TAudioConverter } function TAudioConverter.Init(SrcFormatInfo: TAudioFormatInfo; DstFormatInfo: TAudioFormatInfo): boolean; diff --git a/cmake/src/base/USingScores.pas b/cmake/src/base/USingScores.pas index 2d9b1e5e..89896d2d 100644 --- a/cmake/src/base/USingScores.pas +++ b/cmake/src/base/USingScores.pas @@ -34,211 +34,211 @@ interface {$I switches.inc} uses - UThemes, gl, + UThemes, UTexture; ////////////////////////////////////////////////////////////// // ATTENTION: // -// Enabled Flag does not Work atm. This should cause Popups // -// Not to Move and Scores to stay until Renenabling. // -// To use e.g. in Pause Mode // -// Also InVisible Flag causes Attributes not to change. // -// This should be fixed after next Draw when Visible = True,// -// but not testet yet // +// Enabled flag does not work atm. This should cause popups // +// not to move and scores to stay until re-enabling. // +// To use e.g. in pause mode // +// also invisible flag causes attributes not to change. // +// This should be fixed after next draw when visible = true,// +// but not tested yet // ////////////////////////////////////////////////////////////// -//Some constants containing options that could change by time +// some constants containing options that could change by time const - MaxPlayers = 6; //Maximum of Players that could be added - MaxPositions = 6; //Maximum of Score Positions that could be added + MaxPlayers = 6; // maximum of players that could be added + MaxPositions = 6; // maximum of score positions that could be added type //----------- - // TScorePlayer - Record Containing Information about a Players Score + // TScorePlayer - record containing information about a players score //----------- TScorePlayer = record - Position: Byte; //Index of the Position where the Player should be Drawn - Enabled: Boolean; //Is the Score Display Enabled - Visible: Boolean; //Is the Score Display Visible - Score: Word; //Current Score of the Player - ScoreDisplayed: Word; //Score cur. Displayed(for counting up) - ScoreBG: TTexture;//Texture of the Players Scores BG - Color: TRGB; //Teh Players Color - RBPos: Real; //Cur. Percentille of the Rating Bar - RBTarget: Real; //Target Position of Rating Bar - RBVisible:Boolean; //Is Rating bar Drawn + Position: byte; // index of the position where the player should be drawn + Enabled: boolean; // is the score display enabled + Visible: boolean; // is the score display visible + Score: word; // current score of the player + ScoreDisplayed: word; // score cur. displayed (for counting up) + ScoreBG: TTexture; // texture of the players scores bg + Color: TRGB; // the players color + RBPos: real; // cur. percentille of the rating bar + RBTarget: real; // target position of rating bar + RBVisible: boolean; // is rating bar drawn end; - aScorePlayer = array[0..MaxPlayers-1] of TScorePlayer; + aScorePlayer = array [0..MaxPlayers-1] of TScorePlayer; //----------- - // TScorePosition - Record Containing Information about a Score Position, that can be used + // TScorePosition - record containing information about a score position, that can be used //----------- PScorePosition = ^TScorePosition; TScorePosition = record - //The Position is Used for Which Playercount - PlayerCount: Byte; - // 1 - One Player per Screen - // 2 - 2 Players per Screen - // 4 - 3 Players per Screen - // 6 would be 2 and 3 Players per Screen - - BGX: Real; //X Position of the Score BG - BGY: Real; //Y Position of the Score BG - BGW: Real; //Width of the Score BG - BGH: Real; //Height of the Score BG - - RBX: Real; //X Position of the Rating Bar - RBY: Real; //Y Position of the Rating Bar - RBW: Real; //Width of the Rating Bar - RBH: Real; //Height of the Rating Bar - - TextX: Real; //X Position of the Score Text - TextY: Real; //Y Position of the Score Text - TextFont: Byte; //Font of the Score Text - TextSize: integer; //Size of the Score Text - - PUW: Real; //Width of the LineBonus Popup - PUH: Real; //Height of the LineBonus Popup - PUFont: Byte; //Font for the PopUps - PUFontSize: integer; //FontSize for the PopUps - PUStartX: Real; //X Start Position of the LineBonus Popup - PUStartY: Real; //Y Start Position of the LineBonus Popup - PUTargetX: Real; //X Target Position of the LineBonus Popup - PUTargetY: Real; //Y Target Position of the LineBonus Popup + // the position is used for which playercount + PlayerCount: byte; + // 1 - 1 player per screen + // 2 - 2 players per screen + // 4 - 3 players per screen + // 6 would be 2 and 3 players per screen + + BGX: real; // x position of the score bg + BGY: real; // y position of the score bg + BGW: real; // width of the score bg + BGH: real; // height of the score bg + + RBX: real; // x position of the rating bar + RBY: real; // y position of the rating bar + RBW: real; // width of the rating bar + RBH: real; // height of the rating bar + + TextX: real; // x position of the score text + TextY: real; // y position of the score text + TextFont: byte; // font of the score text + TextSize: integer; // size of the score text + + PUW: real; // width of the line bonus popup + PUH: real; // height of the line bonus popup + PUFont: byte; // font for the popups + PUFontSize: integer; // font size for the popups + PUStartX: real; // x start position of the line bonus popup + PUStartY: real; // y start position of the line bonus popup + PUTargetX: real; // x target position of the line bonus popup + PUTargetY: real; // y target position of the line bonus popup end; - aScorePosition = array[0..MaxPositions-1] of TScorePosition; + aScorePosition = array [0..MaxPositions-1] of TScorePosition; //----------- - // TScorePopUp - Record Containing Information about a LineBonus Popup - // List, Next Item is Saved in Next attribute + // TScorePopUp - record containing information about a line bonus popup + // list, next item is saved in next attribute //----------- PScorePopUp = ^TScorePopUp; TScorePopUp = record - Player: Byte; //Index of the PopUps Player - TimeStamp: Cardinal; //Timestamp of Popups Spawn - Rating: Byte; //0 to 8, Type of Rating (Cool, bad, etc.) - ScoreGiven:Word; //Score that has already been given to the Player - ScoreDiff: Word; //Difference Between Cur Score at Spawn and Old Score - Next: PScorePopUp; //Next Item in List + Player: byte; // index of the popups player + TimeStamp: cardinal; // timestamp of popups spawn + Rating: byte; // 0 to 8, type of rating (cool, bad, etc.) + ScoreGiven: word; // score that has already been given to the player + ScoreDiff: word; // difference between cur score at spawn and old score + Next: PScorePopUp; // next item in list end; aScorePopUp = array of TScorePopUp; //----------- - // TSingScores - Class containing Scores Positions and Drawing Scores, Rating Bar + Popups + // TSingScores - class containing scores positions and drawing scores, rating bar + popups //----------- TSingScores = class private Positions: aScorePosition; - aPlayers: aScorePlayer; - oPositionCount: Byte; - oPlayerCount: Byte; + aPlayers: aScorePlayer; + oPositionCount: byte; + oPlayerCount: byte; - //Saves the First and Last Popup of the List + // saves the first and last popup of the list FirstPopUp: PScorePopUp; LastPopUp: PScorePopUp; - // Draws a Popup by Pointer + // draws a popup by pointer procedure DrawPopUp(const PopUp: PScorePopUp); - // Draws a Score by Playerindex - procedure DrawScore(const Index: Integer); + // draws a score by playerindex + procedure DrawScore(const Index: integer); - // Draws the RatingBar by Playerindex - procedure DrawRatingBar(const Index: Integer); + // draws the rating bar by playerindex + procedure DrawRatingBar(const Index: integer); - // Removes a PopUp w/o destroying the List + // removes a popup w/o destroying the list procedure KillPopUp(const last, cur: PScorePopUp); public - Settings: record //Record containing some Displaying Options - Phase1Time: Real; //time for Phase 1 to complete (in msecs) - //The Plop Up of the PopUp - Phase2Time: Real; //time for Phase 2 to complete (in msecs) - //The Moving (mainly Upwards) of the Popup - Phase3Time: Real; //time for Phase 3 to complete (in msecs) - //The Fade out and Score adding + Settings: record // Record containing some Displaying Options + Phase1Time: real; // time for phase 1 to complete (in msecs) + // the plop up of the popup + Phase2Time: real; // time for phase 2 to complete (in msecs) + // the moving (mainly upwards) of the popup + Phase3Time: real; // time for phase 3 to complete (in msecs) + // the fade out and score adding - PopUpTex: array [0..8] of TTexture; //Textures for every Popup Rating + PopUpTex: array [0..8] of TTexture; // textures for every popup rating - RatingBar_BG_Tex: TTexture; //Rating Bar Texs - RatingBar_FG_Tex: TTexture; - RatingBar_Bar_Tex: TTexture; + RatingBar_BG_Tex: TTexture; // rating bar texs + RatingBar_FG_Tex: TTexture; + RatingBar_Bar_Tex: TTexture; end; - Visible: Boolean; //Visibility of all Scores - Enabled: Boolean; //Scores are changed, PopUps are Moved etc. - RBVisible: Boolean; //Visibility of all Rating Bars + Visible: boolean; // visibility of all scores + Enabled: boolean; // scores are changed, popups are moved etc. + RBVisible: boolean; // visibility of all rating bars - //Propertys for Reading Position and Playercount - property PositionCount: Byte read oPositionCount; - property PlayerCount: Byte read oPlayerCount; - property Players: aScorePlayer read aPlayers; + // properties for reading position and playercount + property PositionCount: byte read oPositionCount; + property PlayerCount: byte read oPlayerCount; + property Players: aScorePlayer read aPlayers; - //Constructor just sets some standard Settings + // constructor just sets some standard settings constructor Create; - // Adds a Position to Array and Increases Position Count + // adds a position to array and increases position count procedure AddPosition(const pPosition: PScorePosition); - // Adds a Player to Array and Increases Player Count - procedure AddPlayer(const ScoreBG: TTexture; const Color: TRGB; const Score: Word = 0; const Enabled: Boolean = True; const Visible: Boolean = True); + // adds a player to array and increases player count + procedure AddPlayer(const ScoreBG: TTexture; const Color: TRGB; const Score: word = 0; const Enabled: boolean = true; const Visible: boolean = true); - //Change a Players Visibility, Enable - procedure ChangePlayerVisibility(const Index: Byte; const pVisible: Boolean); - procedure ChangePlayerEnabled(const Index: Byte; const pEnabled: Boolean); + // change a players visibility, enable + procedure ChangePlayerVisibility(const Index: byte; const pVisible: boolean); + procedure ChangePlayerEnabled(const Index: byte; const pEnabled: boolean); - // Deletes all Player Information + // deletes all player information procedure ClearPlayers; - // Deletes Positions and Playerinformation + // deletes positions and playerinformation procedure Clear; - // Loads some Settings and the Positions from Theme + // loads some settings and the positions from theme procedure LoadfromTheme; - // has to be called after Positions and Players have been added, before first call of Draw - //It gives every Player a Score Position + // has to be called after positions and players have been added, before first call of draw + // it gives every player a score position procedure Init; - //Spawns a new Line Bonus PopUp for the Player - procedure SpawnPopUp(const PlayerIndex: Byte; const Rating: Byte; const Score: Word); + // spawns a new line bonus popup for the player + procedure SpawnPopUp(const PlayerIndex: byte; const Rating: byte; const Score: word); - //Removes all PopUps from Mem + // removes all popups from mem procedure KillAllPopUps; - // Draws Scores and Linebonus PopUps + // draws scores and line bonus popups procedure Draw; end; - implementation -uses SDL, - SysUtils, - ULog, - UGraphic, - TextGL; +uses + SysUtils, + SDL, + TextGL, + ULog, + UGraphic; {** - * Sets some standard Settings + * sets some standard settings *} -Constructor TSingScores.Create; +constructor TSingScores.Create; begin inherited; - //Clear PopupList Pointers + // clear popuplist pointers FirstPopUp := nil; LastPopUp := nil; - //Clear Variables - Visible := True; - Enabled := True; - RBVisible := True; + // clear variables + Visible := true; + Enabled := true; + RBVisible := true; - //Clear Position Index - oPositionCount := 0; - oPlayerCount := 0; + // clear position index + oPositionCount := 0; + oPlayerCount := 0; Settings.Phase1Time := 350; // plop it up . -> [ ] Settings.Phase2Time := 550; // shift it up ^[ ]^ @@ -260,22 +260,21 @@ begin end; {** - * Adds a Position to Array and Increases Position Count + * adds a position to array and increases position count *} -Procedure TSingScores.AddPosition(const pPosition: PScorePosition); +procedure TSingScores.AddPosition(const pPosition: PScorePosition); begin if (PositionCount < MaxPositions) then begin Positions[PositionCount] := pPosition^; - Inc(oPositionCount); end; end; {** - * Adds a Player to Array and Increases Player Count + * adds a player to array and increases player count *} -Procedure TSingScores.AddPlayer(const ScoreBG: TTexture; const Color: TRGB; const Score: Word; const Enabled: Boolean; const Visible: Boolean); +procedure TSingScores.AddPlayer(const ScoreBG: TTexture; const Color: TRGB; const Score: word; const Enabled: boolean; const Visible: boolean); begin if (PlayerCount < MaxPlayers) then begin @@ -283,48 +282,48 @@ begin aPlayers[PlayerCount].Enabled := Enabled; aPlayers[PlayerCount].Visible := Visible; aPlayers[PlayerCount].Score := Score; - aPlayers[PlayerCount].ScoreDisplayed := Score; + aPlayers[PlayerCount].ScoreDisplayed := Score; aPlayers[PlayerCount].ScoreBG := ScoreBG; aPlayers[PlayerCount].Color := Color; aPlayers[PlayerCount].RBPos := 0.5; aPlayers[PlayerCount].RBTarget := 0.5; - aPlayers[PlayerCount].RBVisible := True; + aPlayers[PlayerCount].RBVisible := true; Inc(oPlayerCount); end; end; {** - * Change a Players Visibility + * change a players visibility *} -Procedure TSingScores.ChangePlayerVisibility(const Index: Byte; const pVisible: Boolean); +procedure TSingScores.ChangePlayerVisibility(const Index: byte; const pVisible: boolean); begin if (Index < MaxPlayers) then aPlayers[Index].Visible := pVisible; end; {** - * Change Player Enabled + * change player enabled *} -Procedure TSingScores.ChangePlayerEnabled(const Index: Byte; const pEnabled: Boolean); +procedure TSingScores.ChangePlayerEnabled(const Index: byte; const pEnabled: boolean); begin if (Index < MaxPlayers) then aPlayers[Index].Enabled := pEnabled; end; {** - * Procedure Deletes all Player Information + * procedure deletes all player information *} -Procedure TSingScores.ClearPlayers; +procedure TSingScores.ClearPlayers; begin KillAllPopUps; oPlayerCount := 0; end; {** - * Procedure Deletes Positions and Playerinformation + * procedure deletes positions and playerinformation *} -Procedure TSingScores.Clear; +procedure TSingScores.Clear; begin KillAllPopUps; oPlayerCount := 0; @@ -332,14 +331,16 @@ begin end; {** - * Procedure Loads some Settings and the Positions from Theme + * procedure loads some settings and the positions from theme *} -Procedure TSingScores.LoadfromTheme; -var I: Integer; - Procedure AddbyStatics(const PC: Byte; const ScoreStatic, SingBarStatic: TThemeStatic; ScoreText: TThemeText); - var nPosition: TScorePosition; +procedure TSingScores.LoadfromTheme; +var + I: integer; + procedure AddbyStatics(const PC: byte; const ScoreStatic, SingBarStatic: TThemeStatic; ScoreText: TThemeText); + var + nPosition: TScorePosition; begin - nPosition.PlayerCount := PC; //Only for one Player Playing + nPosition.PlayerCount := PC; // only for one player playing nPosition.BGX := ScoreStatic.X; nPosition.BGY := ScoreStatic.Y; @@ -373,54 +374,55 @@ var I: Integer; begin Clear; - //Set Textures - //Popup Tex - For I := 0 to 8 do + // set textures + // popup tex + for I := 0 to 8 do Settings.PopUpTex[I] := Tex_SingLineBonusBack[I]; - //Rating Bar Tex + // rating bar tex Settings.RatingBar_BG_Tex := Tex_SingBar_Back; Settings.RatingBar_FG_Tex := Tex_SingBar_Front; Settings.RatingBar_Bar_Tex := Tex_SingBar_Bar; - //Load Positions from Theme + // load positions from theme - // Player1: + // player 1: AddByStatics(1, Theme.Sing.StaticP1ScoreBG, Theme.Sing.StaticP1SingBar, Theme.Sing.TextP1Score); AddByStatics(2, Theme.Sing.StaticP1TwoPScoreBG, Theme.Sing.StaticP1TwoPSingBar, Theme.Sing.TextP1TwoPScore); AddByStatics(4, Theme.Sing.StaticP1ThreePScoreBG, Theme.Sing.StaticP1ThreePSingBar, Theme.Sing.TextP1ThreePScore); - // Player2: + // player 2: AddByStatics(2, Theme.Sing.StaticP2RScoreBG, Theme.Sing.StaticP2RSingBar, Theme.Sing.TextP2RScore); AddByStatics(4, Theme.Sing.StaticP2MScoreBG, Theme.Sing.StaticP2MSingBar, Theme.Sing.TextP2MScore); - // Player3: + // player 3: AddByStatics(4, Theme.Sing.StaticP3RScoreBG, Theme.Sing.StaticP3SingBar, Theme.Sing.TextP3RScore); end; {** - * Spawns a new Line Bonus PopUp for the Player + * spawns a new line bonus popup for the player *} -Procedure TSingScores.SpawnPopUp(const PlayerIndex: Byte; const Rating: Byte; const Score: Word); -var Cur: PScorePopUp; +procedure TSingScores.SpawnPopUp(const PlayerIndex: byte; const Rating: byte; const Score: word); +var + Cur: PScorePopUp; begin if (PlayerIndex < PlayerCount) then begin - //Get Memory and Add Data + // get memory and add data GetMem(Cur, SizeOf(TScorePopUp)); - Cur.Player := PlayerIndex; + Cur.Player := PlayerIndex; Cur.TimeStamp := SDL_GetTicks; - //limit rating value to 8 - //a higher value would cause a crash when selecting the bg textur + // limit rating value to 8 + // a higher value would cause a crash when selecting the bg texture if (Rating > 8) then Cur.Rating := 8 else Cur.Rating := Rating; Cur.ScoreGiven:= 0; - If (Players[PlayerIndex].Score < Score) then + if (Players[PlayerIndex].Score < Score) then begin Cur.ScoreDiff := Score - Players[PlayerIndex].Score; aPlayers[PlayerIndex].Score := Score; @@ -429,77 +431,77 @@ begin Cur.ScoreDiff := 0; Cur.Next := nil; - //Log.LogError('TSingScores.SpawnPopUp| Player: ' + InttoStr(PlayerIndex) + ', Score: ' + InttoStr(Score) + ', ScoreDiff: ' + InttoStr(Cur.ScoreDiff)); + // Log.LogError('TSingScores.SpawnPopUp| Player: ' + InttoStr(PlayerIndex) + ', Score: ' + InttoStr(Score) + ', ScoreDiff: ' + InttoStr(Cur.ScoreDiff)); - //Add it to the Chain + // add it to the chain if (FirstPopUp = nil) then - //the first PopUp in the List + // the first popup in the list FirstPopUp := Cur else - //second or earlier popup + // second or earlier popup LastPopUp.Next := Cur; - //Set new Popup to Last PopUp in the List + // set new popup to last popup in the list LastPopUp := Cur; end else - Log.LogError('TSingScores: Try to add PopUp for not existing player'); + Log.LogError('TSingScores: Try to add popup for non-existing player'); end; {** - * Removes a PopUp w/o destroying the List + * removes a popup w/o destroying the list *} -Procedure TSingScores.KillPopUp(const last, cur: PScorePopUp); +procedure TSingScores.KillPopUp(const last, cur: PScorePopUp); begin - //Give Player the Last Points that missing till now + // give player the last points that missing till now aPlayers[Cur.Player].ScoreDisplayed := aPlayers[Cur.Player].ScoreDisplayed + Cur.ScoreDiff - Cur.ScoreGiven; - //Change Bars Position + // change bars position if (Cur.ScoreDiff > 0) THEN - begin //Popup w/ scorechange -> give missing Percentille + begin // popup w/ scorechange -> give missing percentille aPlayers[Cur.Player].RBTarget := aPlayers[Cur.Player].RBTarget + (Cur.ScoreDiff - Cur.ScoreGiven) / Cur.ScoreDiff * (Cur.Rating / 20 - 0.26); end else - begin //Popup w/o scorechange -> give complete Percentille + begin // popup w/o scorechange -> give complete percentille aPlayers[Cur.Player].RBTarget := aPlayers[Cur.Player].RBTarget + (Cur.Rating / 20 - 0.26); end; - If (aPlayers[Cur.Player].RBTarget > 1) then + if (aPlayers[Cur.Player].RBTarget > 1) then aPlayers[Cur.Player].RBTarget := 1 else - If (aPlayers[Cur.Player].RBTarget < 0) then + if (aPlayers[Cur.Player].RBTarget < 0) then aPlayers[Cur.Player].RBTarget := 0; - //If this is the First PopUp => Make Next PopUp the First - If (Cur = FirstPopUp) then + // if this is the first popup => make next popup the first + if (Cur = FirstPopUp) then FirstPopUp := Cur.Next - //Else => Remove Curent Popup from Chain + // else => remove curent popup from chain else Last.Next := Cur.Next; - //If this is the Last PopUp, Make PopUp before the Last - If (Cur = LastPopUp) then + // if this is the last popup, make popup before the last + if (Cur = LastPopUp) then LastPopUp := Last; - //Free the Memory + // free the memory FreeMem(Cur, SizeOf(TScorePopUp)); end; {** - * Removes all PopUps from Mem + * removes all popups from mem *} -Procedure TSingScores.KillAllPopUps; +procedure TSingScores.KillAllPopUps; var Cur: PScorePopUp; Last: PScorePopUp; begin Cur := FirstPopUp; - //Remove all PopUps: - While (Cur <> nil) do + // remove all popups: + while (Cur <> nil) do begin Last := Cur; Cur := Cur.Next; @@ -511,40 +513,42 @@ begin end; {** - * Has to be called after Positions and Players have been added, before first call of Draw - * It gives every Player a Score Position + * has to be called after positions and players have been added, before first call of draw + * it gives each player a score position *} -Procedure TSingScores.Init; +procedure TSingScores.Init; var - PlC: Array [0..1] of Byte; //Playercount First Screen and Second Screen - I, J: Integer; - MaxPlayersperScreen: Byte; - CurPlayer: Byte; - - Function GetPositionCountbyPlayerCount(bPlayerCount: Byte): Byte; - var I: Integer; + PlC: array [0..1] of byte; // playercount first screen and second screen + I, J: integer; + MaxPlayersperScreen: byte; + CurPlayer: byte; + + function GetPositionCountbyPlayerCount(bPlayerCount: byte): byte; + var + I: integer; begin Result := 0; bPlayerCount := 1 shl (bPlayerCount - 1); - For I := 0 to PositionCount-1 do + for I := 0 to PositionCount - 1 do begin - If ((Positions[I].PlayerCount AND bPlayerCount) <> 0) then + if ((Positions[I].PlayerCount and bPlayerCount) <> 0) then Inc(Result); end; end; - Function GetPositionbyPlayernum(bPlayerCount, bPlayer: Byte): Byte; - var I: Integer; + function GetPositionbyPlayernum(bPlayerCount, bPlayer: byte): byte; + var + I: integer; begin bPlayerCount := 1 shl (bPlayerCount - 1); - Result := High(Byte); + Result := High(byte); - For I := 0 to PositionCount-1 do + for I := 0 to PositionCount - 1 do begin - If ((Positions[I].PlayerCount AND bPlayerCount) <> 0) then + if ((Positions[I].PlayerCount and bPlayerCount) <> 0) then begin - If (bPlayer = 0) then + if (bPlayer = 0) then begin Result := I; Break; @@ -558,17 +562,16 @@ var begin MaxPlayersPerScreen := 0; - For I := 1 to 6 do + for I := 1 to 6 do begin - //If there are enough Positions -> Write to MaxPlayers - If (GetPositionCountbyPlayerCount(I) = I) then + // if there are enough positions -> write to maxplayers + if (GetPositionCountbyPlayerCount(I) = I) then MaxPlayersPerScreen := I else Break; end; - - //Split Players to both Screen or Display on One Screen + // split players to both screens or display on one screen if (Screens = 2) and (MaxPlayersPerScreen < PlayerCount) then begin PlC[0] := PlayerCount div 2 + PlayerCount mod 2; @@ -580,9 +583,8 @@ begin PlC[1] := 0; end; - - //Check if there are enough Positions for all Players - For I := 0 to Screens - 1 do + // check if there are enough positions for all players + for I := 0 to Screens - 1 do begin if (PlC[I] > MaxPlayersperScreen) then begin @@ -592,34 +594,34 @@ begin end; CurPlayer := 0; - //Give every Player a Position - For I := 0 to Screens - 1 do - For J := 0 to PlC[I]-1 do + // give every player a position + for I := 0 to Screens - 1 do + for J := 0 to PlC[I]-1 do begin - aPlayers[CurPlayer].Position := GetPositionbyPlayernum(PlC[I], J) OR (I shl 7); - //Log.LogError('Player ' + InttoStr(CurPlayer) + ' gets Position: ' + InttoStr(aPlayers[CurPlayer].Position)); + aPlayers[CurPlayer].Position := GetPositionbyPlayernum(PlC[I], J) or (I shl 7); + // Log.LogError('Player ' + InttoStr(CurPlayer) + ' gets Position: ' + InttoStr(aPlayers[CurPlayer].Position)); Inc(CurPlayer); end; end; {** - * Draws Scores and Linebonus PopUps + * draws scores and linebonus popups *} -Procedure TSingScores.Draw; +procedure TSingScores.Draw; var - I: Integer; - CurTime: Cardinal; + I: integer; + CurTime: cardinal; CurPopUp, LastPopUp: PScorePopUp; begin CurTime := SDL_GetTicks; - If Visible then + if Visible then begin - //Draw Popups + // draw popups LastPopUp := nil; CurPopUp := FirstPopUp; - While (CurPopUp <> nil) do + while (CurPopUp <> nil) do begin if (CurTime - CurPopUp.TimeStamp > Settings.Phase1Time + Settings.Phase2Time + Settings.Phase3Time) then begin @@ -638,64 +640,64 @@ begin end; - IF (RBVisible) then - //Draw Players w/ Rating Bar - For I := 0 to PlayerCount-1 do + if (RBVisible) then + // draw players w/ rating bar + for I := 0 to PlayerCount-1 do begin DrawScore(I); DrawRatingBar(I); end else - //Draw Players w/o Rating Bar - For I := 0 to PlayerCount-1 do + // draw players w/o rating bar + for I := 0 to PlayerCount-1 do begin DrawScore(I); end; - end; //eo Visible + end; // eo visible end; {** - * Draws a Popup by Pointer + * draws a popup by pointer *} -Procedure TSingScores.DrawPopUp(const PopUp: PScorePopUp); +procedure TSingScores.DrawPopUp(const PopUp: PScorePopUp); var - Progress: Real; - CurTime: Cardinal; - X, Y, W, H, Alpha: Real; - FontSize: integer; - FontOffset: Real; - TimeDiff: Cardinal; - PIndex: Byte; - TextLen: Real; - ScoretoAdd: Word; - PosDiff: Real; + Progress: real; + CurTime: cardinal; + X, Y, W, H, Alpha: real; + FontSize: integer; + FontOffset: real; + TimeDiff: cardinal; + PIndex: byte; + TextLen: real; + ScoretoAdd: word; + PosDiff: real; begin if (PopUp <> nil) then begin - //Only Draw if Player has a Position + // only draw if player has a position PIndex := Players[PopUp.Player].Position; - If PIndex <> high(byte) then + if PIndex <> High(byte) then begin - //Only Draw if Player is on Cur Screen - If ((Players[PopUp.Player].Position AND 128) = 0) = (ScreenAct = 1) then + // only draw if player is on cur screen + if ((Players[PopUp.Player].Position and 128) = 0) = (ScreenAct = 1) then begin CurTime := SDL_GetTicks; - If Not (Enabled AND Players[PopUp.Player].Enabled) then - //Increase Timestamp with TIem where there is no Movement ... + if not (Enabled and Players[PopUp.Player].Enabled) then + // increase timestamp with tiem where there is no movement ... begin - //Inc(PopUp.TimeStamp, LastRender); + // Inc(PopUp.TimeStamp, LastRender); end; TimeDiff := CurTime - PopUp.TimeStamp; - //Get Position of PopUp - PIndex := PIndex AND 127; + // get position of popup + PIndex := PIndex and 127; - //Check for Phase ... - If (TimeDiff <= Settings.Phase1Time) then + // check for phase ... + if (TimeDiff <= Settings.Phase1Time) then begin - //Phase 1 - The Ploping up + // phase 1 - the ploping up Progress := TimeDiff / Settings.Phase1Time; @@ -706,25 +708,25 @@ begin Y := Positions[PIndex].PUStartY + (Positions[PIndex].PUH - H)/2; FontSize := Round(Progress * Positions[PIndex].PUFontSize); - FontOffset := (H - FontSize) / 2; + FontOffset := (H - FontSize) / 2; Alpha := 1; end - Else If (TimeDiff <= Settings.Phase2Time + Settings.Phase1Time) then + else if (TimeDiff <= Settings.Phase2Time + Settings.Phase1Time) then begin - //Phase 2 - The Moving + // phase 2 - the moving Progress := (TimeDiff - Settings.Phase1Time) / Settings.Phase2Time; W := Positions[PIndex].PUW; H := Positions[PIndex].PUH; PosDiff := Positions[PIndex].PUTargetX - Positions[PIndex].PUStartX; - If PosDiff > 0 then + if PosDiff > 0 then PosDiff := PosDiff + W; X := Positions[PIndex].PUStartX + PosDiff * sqr(Progress); PosDiff := Positions[PIndex].PUTargetY - Positions[PIndex].PUStartY; - If PosDiff < 0 then + if PosDiff < 0 then PosDiff := PosDiff + Positions[PIndex].BGH; Y := Positions[PIndex].PUStartY + PosDiff * sqr(Progress); @@ -735,65 +737,68 @@ begin else begin - //Phase 3 - The Fading out + Score adding + // phase 3 - the fading out + score adding Progress := (TimeDiff - Settings.Phase1Time - Settings.Phase2Time) / Settings.Phase3Time; - If (PopUp.Rating > 0) then + if (PopUp.Rating > 0) then begin - //Add Scores if Player Enabled - If (Enabled AND Players[PopUp.Player].Enabled) then + // add scores if player enabled + if (Enabled and Players[PopUp.Player].Enabled) then begin ScoreToAdd := Round(PopUp.ScoreDiff * Progress) - PopUp.ScoreGiven; Inc(PopUp.ScoreGiven, ScoreToAdd); aPlayers[PopUp.Player].ScoreDisplayed := Players[PopUp.Player].ScoreDisplayed + ScoreToAdd; - //Change Bars Position - aPlayers[PopUp.Player].RBTarget := aPlayers[PopUp.Player].RBTarget + ScoreToAdd/PopUp.ScoreDiff * (PopUp.Rating / 20 - 0.26); - If (aPlayers[PopUp.Player].RBTarget > 1) then + // change bar positions + if PopUp.ScoreDiff = 0 then + Log.LogError('TSingScores.DrawPopUp', 'PopUp.ScoreDiff is 0 and we want to divide by it. No idea how this happens.') + else + aPlayers[PopUp.Player].RBTarget := aPlayers[PopUp.Player].RBTarget + ScoreToAdd/PopUp.ScoreDiff * (PopUp.Rating / 20 - 0.26); + if (aPlayers[PopUp.Player].RBTarget > 1) then aPlayers[PopUp.Player].RBTarget := 1 - else If (aPlayers[PopUp.Player].RBTarget < 0) then + else if (aPlayers[PopUp.Player].RBTarget < 0) then aPlayers[PopUp.Player].RBTarget := 0; end; - //Set Positions etc. - Alpha := 0.7 - 0.7 * Progress; + // set positions etc. + Alpha := 0.7 - 0.7 * Progress; W := Positions[PIndex].PUW; H := Positions[PIndex].PUH; PosDiff := Positions[PIndex].PUTargetX - Positions[PIndex].PUStartX; - If (PosDiff > 0) then + if (PosDiff > 0) then PosDiff := W else PosDiff := 0; X := Positions[PIndex].PUTargetX + PosDiff * Progress; PosDiff := Positions[PIndex].PUTargetY - Positions[PIndex].PUStartY; - If (PosDiff < 0) then + if (PosDiff < 0) then PosDiff := -Positions[PIndex].BGH else PosDiff := 0; - Y := Positions[PIndex].PUTargetY - PosDiff * (1-Progress); + Y := Positions[PIndex].PUTargetY - PosDiff * (1 - Progress); FontSize := Positions[PIndex].PUFontSize; FontOffset := (H - FontSize) / 2; end else begin - //Here the Effect that Should be shown if a PopUp without Score is Drawn - //And or Spawn with the GraphicObjects etc. - //Some Work for Blindy to do :P + // here the effect that should be shown if a popup without score is drawn + // and or spawn with the graphicobjects etc. + // some work for blindy to do :p - //ATM: Just Let it Slide in the Scores just like the Normal PopUp + // atm: just let it slide in the scores just like the normal popup Alpha := 0; end; end; - //Draw PopUp + // draw popup - if (Alpha > 0) AND (Players[PopUp.Player].Visible) then + if (Alpha > 0) and (Players[PopUp.Player].Visible) then begin - //Draw BG: + // draw bg: glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); @@ -811,45 +816,46 @@ begin glDisable(GL_TEXTURE_2D); glDisable(GL_BLEND); - //Set FontStyle and Size + // set font style and size SetFontStyle(Positions[PIndex].PUFont); - SetFontItalic(False); + SetFontItalic(false); SetFontSize(FontSize); + SetFontReflection(false, 0); - //Draw Text + // draw text TextLen := glTextWidth(Theme.Sing.LineBonusText[PopUp.Rating]); - //Color and Pos + // color and pos SetFontPos (X + (W - TextLen) / 2, Y + FontOffset); glColor4f(1, 1, 1, Alpha); - //Draw + // draw glPrint(Theme.Sing.LineBonusText[PopUp.Rating]); - end; //eo Alpha check - end; //eo Right Screen - end; //eo Player has Position + end; // eo alpha check + end; // eo right screen + end; // eo player has position end else - Log.LogError('TSingScores: Try to Draw a not existing PopUp'); + Log.LogError('TSingScores: Try to draw a non-existing popup'); end; {** - * Draws a Score by Playerindex + * draws a score by playerindex *} -Procedure TSingScores.DrawScore(const Index: Integer); +procedure TSingScores.DrawScore(const Index: integer); var Position: PScorePosition; ScoreStr: String; begin - //Only Draw if Player has a Position - If Players[Index].Position <> high(byte) then + // only draw if player has a position + if Players[Index].Position <> High(byte) then begin - //Only Draw if Player is on Cur Screen - If (((Players[Index].Position AND 128) = 0) = (ScreenAct = 1)) AND Players[Index].Visible then + // only draw if player is on cur screen + if (((Players[Index].Position and 128) = 0) = (ScreenAct = 1)) and Players[Index].Visible then begin Position := @Positions[Players[Index].Position and 127]; - //Draw ScoreBG + // draw scorebg glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); @@ -867,50 +873,51 @@ begin glDisable(GL_TEXTURE_2D); glDisable(GL_BLEND); - //Draw Score Text + // draw score text SetFontStyle(Position.TextFont); - SetFontItalic(False); + SetFontItalic(false); SetFontSize(Position.TextSize); SetFontPos(Position.TextX, Position.TextY); + SetFontReflection(false, 0); ScoreStr := InttoStr(Players[Index].ScoreDisplayed div 10) + '0'; - While (Length(ScoreStr) < 5) do + while (Length(ScoreStr) < 5) do ScoreStr := '0' + ScoreStr; glPrint(ScoreStr); - end; //eo Right Screen - end; //eo Player has Position + end; // eo right screen + end; // eo player has position end; -Procedure TSingScores.DrawRatingBar(const Index: Integer); +procedure TSingScores.DrawRatingBar(const Index: integer); var - Position: PScorePosition; - R,G,B, Size: Real; - Diff: Real; + Position: PScorePosition; + R, G, B: real; + Size, Diff: real; begin - //Only Draw if Player has a Position - if Players[Index].Position <> high(byte) then + // only draw if player has a position + if Players[Index].Position <> High(byte) then begin - //Only Draw if Player is on Cur Screen + // only draw if player is on cur screen if (((Players[Index].Position and 128) = 0) = (ScreenAct = 1) and Players[index].RBVisible and Players[index].Visible) then begin Position := @Positions[Players[Index].Position and 127]; - if (Enabled AND Players[Index].Enabled) then + if (Enabled and Players[Index].Enabled) then begin - //Move Position if Enabled + // move position if enabled Diff := Players[Index].RBTarget - Players[Index].RBPos; - If(Abs(Diff) < 0.02) then + if (Abs(Diff) < 0.02) then aPlayers[Index].RBPos := aPlayers[Index].RBTarget else aPlayers[Index].RBPos := aPlayers[Index].RBPos + Diff*0.1; end; - //Get Colors for RatingBar + // get colors for rating bar if (Players[index].RBPos <= 0.22) then begin R := 1; @@ -920,7 +927,7 @@ begin else if (Players[index].RBPos <= 0.42) then begin R := 1; - G := Players[index].RBPos*5; + G := Players[index].RBPos * 5; B := 0; end else if (Players[index].RBPos <= 0.57) then @@ -931,7 +938,7 @@ begin end else if (Players[index].RBPos <= 0.77) then begin - R := 1-(Players[index].RBPos-0.57)*5; + R := 1 - (Players[index].RBPos - 0.57) * 5; G := 1; B := 0; end @@ -942,12 +949,12 @@ begin B := 0; end; - //Enable all glFuncs Needed + // enable all glfuncs needed glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - //Draw RatingBar BG + // draw rating bar bg glColor4f(1, 1, 1, 0.8); glBindTexture(GL_TEXTURE_2D, Settings.RatingBar_BG_Tex.TexNum); @@ -965,7 +972,7 @@ begin glVertex2f(Position.RBX+Position.RBW, Position.RBY); glEnd; - //Draw Rating bar itself + // draw rating bar itself Size := Position.RBX + Position.RBW * Players[Index].RBPos; glColor4f(R, G, B, 1); glBindTexture(GL_TEXTURE_2D, Settings.RatingBar_Bar_Tex.TexNum); @@ -983,7 +990,7 @@ begin glVertex2f(Size, Position.RBY); glEnd; - //Draw Ratingbar FG (Teh thing with the 3 lines to get better readability) + // draw rating bar fg (the thing with the 3 lines to get better readability) glColor4f(1, 1, 1, 0.6); glBindTexture(GL_TEXTURE_2D, Settings.RatingBar_FG_Tex.TexNum); glBegin(GL_QUADS); @@ -1000,11 +1007,11 @@ begin glVertex2f(Position.RBX + Position.RBW, Position.RBY); glEnd; - //Disable all Enabled glFuncs + // disable all enabled glfuncs glDisable(GL_TEXTURE_2D); glDisable(GL_BLEND); - end; //eo Right Screen - end; //eo Player has Position + end; // eo Right Screen + end; // eo Player has Position end; end. diff --git a/cmake/src/base/UTexture.pas b/cmake/src/base/UTexture.pas index 962bd2b0..97f244fe 100644 --- a/cmake/src/base/UTexture.pas +++ b/cmake/src/base/UTexture.pas @@ -336,8 +336,8 @@ begin X := 0; Y := 0; Z := 0; - W := 0; - H := 0; + W := oldWidth; + H := oldHeight; ScaleW := 1; ScaleH := 1; Rot := 0; diff --git a/cmake/src/base/UThemes.pas b/cmake/src/base/UThemes.pas index 9bf858ed..3fd77853 100644 --- a/cmake/src/base/UThemes.pas +++ b/cmake/src/base/UThemes.pas @@ -42,13 +42,13 @@ uses type TRGB = record - R: single; - G: single; - B: single; + R: single; + G: single; + B: single; end; TRGBA = record - R, G, B, A: Double; + R, G, B, A: double; end; type @@ -175,11 +175,12 @@ type W: integer; H: integer; Z: real; + SBGW: integer; TextSize: integer; - //SBGW Mod - SBGW: integer; + showArrows:boolean; + oneItemOnly:boolean; Text: string; ColR, ColG, ColB, Int: real; @@ -359,6 +360,11 @@ type PausePopUp: TThemeStatic; end; + TThemeLyricBar = record + IndicatorYOffset, UpperX, UpperW, UpperY, UpperH, + LowerX, LowerW, LowerY, LowerH : integer; + end; + TThemeScore = class(TThemeBasic) TextArtist: TThemeText; TextTitle: TThemeText; @@ -723,6 +729,7 @@ type Level: TThemeLevel; Song: TThemeSong; Sing: TThemeSing; + LyricBar: TThemeLyricBar; Score: TThemeScore; Top5: TThemeTop5; Options: TThemeOptions; @@ -1031,9 +1038,19 @@ begin ThemeLoadStatic(Song.StaticTeam3Joker5, 'SongStaticTeam3Joker5'); + //LyricBar asd + LyricBar.UpperX := ThemeIni.ReadInteger('SingLyricsUpperBar', 'X', 0); + LyricBar.UpperW := ThemeIni.ReadInteger('SingLyricsUpperBar', 'W', 0); + LyricBar.UpperY := ThemeIni.ReadInteger('SingLyricsUpperBar', 'Y', 0); + LyricBar.UpperH := ThemeIni.ReadInteger('SingLyricsUpperBar', 'H', 0); + LyricBar.IndicatorYOffset := ThemeIni.ReadInteger('SingLyricsUpperBar', 'IndicatorYOffset', 0); + LyricBar.LowerX := ThemeIni.ReadInteger('SingLyricsLowerBar', 'X', 0); + LyricBar.LowerW := ThemeIni.ReadInteger('SingLyricsLowerBar', 'W', 0); + LyricBar.LowerY := ThemeIni.ReadInteger('SingLyricsLowerBar', 'Y', 0); + LyricBar.LowerH := ThemeIni.ReadInteger('SingLyricsLowerBar', 'H', 0); + // Sing ThemeLoadBasic(Sing, 'Sing'); - //TimeBar mod ThemeLoadStatic(Sing.StaticTimeProgress, 'SingTimeProgress'); ThemeLoadText(Sing.TextTimeText, 'SingTimeText'); @@ -1769,7 +1786,7 @@ begin ThemeSelectS.SkipX := ThemeIni.ReadInteger(Name, 'SkipX', 0); - ThemeSelectS.SBGW := ThemeIni.ReadInteger(Name, 'SBGW', 450); + ThemeSelectS.SBGW := ThemeIni.ReadInteger(Name, 'SBGW', 400); LoadColor(ThemeSelectS.ColR, ThemeSelectS.ColG, ThemeSelectS.ColB, ThemeIni.ReadString(Name, 'Color', '')); ThemeSelectS.Int := ThemeIni.ReadFloat(Name, 'Int', 1); diff --git a/cmake/src/base/UTime.pas b/cmake/src/base/UTime.pas index 3f35dffd..83844cb5 100644 --- a/cmake/src/base/UTime.pas +++ b/cmake/src/base/UTime.pas @@ -61,20 +61,20 @@ procedure CountSkipTime; procedure CountMidTime; var - USTime : TTime; + USTime: TTime; VideoBGTimer: TRelativeTimer; - TimeNew : int64; - TimeOld : int64; - TimeSkip : real; - TimeMid : real; - TimeMidTemp : int64; + TimeNew: int64; + TimeOld: int64; + TimeSkip: real; + TimeMid: real; + TimeMidTemp: int64; implementation uses sdl, - ucommon; + UCommon; const cSDLCorrectionRatio = 1000; @@ -91,14 +91,14 @@ http://www.gamedev.net/community/forums/topic.asp?topic_id=466145&whichpage=1%EE procedure CountSkipTimeSet; begin - TimeNew := SDL_GetTicks(); + TimeNew := SDL_GetTicks(); end; procedure CountSkipTime; begin - TimeOld := TimeNew; - TimeNew := SDL_GetTicks(); - TimeSkip := (TimeNew-TimeOld) / cSDLCorrectionRatio; + TimeOld := TimeNew; + TimeNew := SDL_GetTicks(); + TimeSkip := (TimeNew-TimeOld) / cSDLCorrectionRatio; end; procedure CountMidTime; @@ -127,10 +127,10 @@ end; **} (* - * Creates a new timer. - * If TriggerMode is false (default), the timer + * creates a new timer. + * if triggermode is false (default), the timer * will immediately begin with counting. - * If TriggerMode is true, it will wait until Get/SetTime() or Pause() is called + * if triggermode is true, it will wait until get/settime() or pause() is called * for the first time. *) constructor TRelativeTimer.Create(TriggerMode: boolean); diff --git a/cmake/src/lib/ffmpeg/avcodec.pas b/cmake/src/lib/ffmpeg/avcodec.pas index 6039835c..ceb1b7f0 100644 --- a/cmake/src/lib/ffmpeg/avcodec.pas +++ b/cmake/src/lib/ffmpeg/avcodec.pas @@ -29,6 +29,11 @@ * Min. version: 51.16.0, revision 6577, Sat Oct 7 15:30:46 2006 UTC * Max. version: 52.11.0, revision 16912, Sun Feb 1 02:00:19 2009 UTC *) +{ + * update to + * Max. version: 52.31.2, Sar Jun 13 22:05:00 2009 UTC + * MiSchi +} unit avcodec; @@ -60,8 +65,8 @@ uses const (* Max. supported version by this header *) LIBAVCODEC_MAX_VERSION_MAJOR = 52; - LIBAVCODEC_MAX_VERSION_MINOR = 11; - LIBAVCODEC_MAX_VERSION_RELEASE = 0; + LIBAVCODEC_MAX_VERSION_MINOR = 31; + LIBAVCODEC_MAX_VERSION_RELEASE = 2; LIBAVCODEC_MAX_VERSION = (LIBAVCODEC_MAX_VERSION_MAJOR * VERSION_MAJOR) + (LIBAVCODEC_MAX_VERSION_MINOR * VERSION_MINOR) + (LIBAVCODEC_MAX_VERSION_RELEASE * VERSION_RELEASE); @@ -85,9 +90,9 @@ const {$IFEND} const - AV_NOPTS_VALUE: cint64 = $8000000000000000; + AV_NOPTS_VALUE: cint64 = $8000000000000000; AV_TIME_BASE = 1000000; - AV_TIME_BASE_Q : TAVRational = (num: 1; den: AV_TIME_BASE); + AV_TIME_BASE_Q: TAVRational = (num: 1; den: AV_TIME_BASE); (** * Identifies the syntax and semantics of the bitstream. @@ -233,6 +238,28 @@ type CODEC_ID_MOTIONPIXELS, CODEC_ID_TGV, CODEC_ID_TGQ, +{$IF LIBAVCODEC_VERSION >= 52012000} // >= 52.12.0 + CODEC_ID_TQI, +{$IFEND} +{$IF LIBAVCODEC_VERSION >= 52022002} // >= 52.22.2 + CODEC_ID_AURA, + CODEC_ID_AURA2, +{$IFEND} +{$IF LIBAVCODEC_VERSION >= 52027000} // >= 52.27.0 + CODEC_ID_V210X, +{$IFEND} +{$IF LIBAVCODEC_VERSION >= 52028000} // >= 52.28.0 + CODEC_ID_TMV, +{$IFEND} +{$IF LIBAVCODEC_VERSION >= 52029000} // >= 52.29.0 + CODEC_ID_V210, +{$IFEND} +{$IF LIBAVCODEC_VERSION >= 52030002} // >= 52.30.2 + CODEC_ID_DPX, +{$IFEND} +{$IF LIBAVCODEC_VERSION >= 52031002} // >= 52.31.2 + CODEC_ID_MAD, +{$IFEND} //* various PCM "codecs" */ CODEC_ID_PCM_S16LE= $10000, @@ -308,7 +335,7 @@ type CODEC_ID_MP2= $15000, CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3 CODEC_ID_AAC, - {$IF LIBAVCODEC_VERSION < 52000000} // 52.0.0 + {$IF LIBAVCODEC_VERSION < 52000000} // < 52.0.0 _CODEC_ID_MPEG4AAC, // will be redefined to CODEC_ID_AAC below {$IFEND} CODEC_ID_AC3, @@ -354,6 +381,15 @@ type CODEC_ID_EAC3, CODEC_ID_SIPR, CODEC_ID_MP1, +{$IF LIBAVCODEC_VERSION >= 52020000} // >= 52.20.0 + CODEC_ID_TWINVQ, +{$IFEND} +{$IF LIBAVCODEC_VERSION >= 52022000} // >= 52.22.0 + CODEC_ID_TRUEHD, +{$IFEND} +{$IF LIBAVCODEC_VERSION >= 52026000} // >= 52.26.0 + CODEC_ID_MP4ALS, +{$IFEND} //* subtitle codecs */ CODEC_ID_DVD_SUBTITLE= $17000, @@ -369,11 +405,11 @@ type CODEC_ID_PROBE= $19000, ///< codec_id is not known (like CODEC_ID_NONE) but lavf should attempt to identify it CODEC_ID_MPEG2TS= $20000, {*< _FAKE_ codec to indicate a raw MPEG-2 TS - * stream (only used by libavformat) *} + * stream (only used by libavformat) *} __CODEC_ID_4BYTE = $FFFFF // ensure 4-byte enum ); -{$IF LIBAVCODEC_VERSION < 52000000} // 52.0.0 +{$IF LIBAVCODEC_VERSION < 52000000} // < 52.0.0 {* CODEC_ID_MP3LAME is obsolete *} const CODEC_ID_MP3LAME = CODEC_ID_MP3; @@ -407,7 +443,7 @@ type _TSampleFormatArray = array [0 .. MaxInt div SizeOf(TSampleFormat)-1] of TSampleFormat; PSampleFormatArray = ^_TSampleFormatArray; -const +const {* Audio channel masks *} CH_FRONT_LEFT = $00000001; CH_FRONT_RIGHT = $00000002; @@ -434,13 +470,28 @@ const CH_LAYOUT_MONO = (CH_FRONT_CENTER); CH_LAYOUT_STEREO = (CH_FRONT_LEFT or CH_FRONT_RIGHT); CH_LAYOUT_SURROUND = (CH_LAYOUT_STEREO or CH_FRONT_CENTER); +{$IF LIBAVCODEC_VERSION >= 52027000} // >= 52.27.0 + CH_LAYOUT_2_1 = (CH_LAYOUT_STEREO or CH_BACK_CENTER); + CH_LAYOUT_4POINT0 = (CH_LAYOUT_SURROUND or CH_BACK_CENTER); + CH_LAYOUT_2_2 = (CH_LAYOUT_STEREO or CH_SIDE_LEFT or CH_SIDE_RIGHT); +{$IFEND} CH_LAYOUT_QUAD = (CH_LAYOUT_STEREO or CH_BACK_LEFT or CH_BACK_RIGHT); CH_LAYOUT_5POINT0 = (CH_LAYOUT_SURROUND or CH_SIDE_LEFT or CH_SIDE_RIGHT); CH_LAYOUT_5POINT1 = (CH_LAYOUT_5POINT0 or CH_LOW_FREQUENCY); +{$IF LIBAVCODEC_VERSION >= 52025000} // >= 52.25.0 + CH_LAYOUT_5POINT0_BACK = (CH_LAYOUT_SURROUND or CH_BACK_LEFT or + CH_BACK_RIGHT); + CH_LAYOUT_5POINT1_BACK = (CH_LAYOUT_5POINT0_BACK or CH_LOW_FREQUENCY); +{$IFEND} CH_LAYOUT_7POINT1 = (CH_LAYOUT_5POINT1 or CH_BACK_LEFT or CH_BACK_RIGHT); +{$IF LIBAVCODEC_VERSION < 52025000} // < 52.25.0 CH_LAYOUT_7POINT1_WIDE = (CH_LAYOUT_SURROUND or CH_LOW_FREQUENCY or - CH_BACK_LEFT or CH_BACK_RIGHT or - CH_FRONT_LEFT_OF_CENTER or CH_FRONT_RIGHT_OF_CENTER); + CH_BACK_LEFT or CH_BACK_RIGHT or +{$ELSE} + CH_LAYOUT_7POINT1_WIDE = (CH_LAYOUT_5POINT1_BACK or +{$IFEND} + CH_FRONT_LEFT_OF_CENTER or + CH_FRONT_RIGHT_OF_CENTER); CH_LAYOUT_STEREO_DOWNMIX = (CH_STEREO_LEFT or CH_STEREO_RIGHT); @@ -482,20 +533,76 @@ type TAVDiscard = ( {* We leave some space between them for extensions (drop some - * keyframes for intra-only or drop just some bidir frames). *} - AVDISCARD_NONE =-16, ///< discard nothing - AVDISCARD_DEFAULT= 0, ///< discard useless packets like 0 size packets in avi - AVDISCARD_NONREF = 8, ///< discard all non reference - AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames - AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes - AVDISCARD_ALL = 48 ///< discard all + * keyframes for intra-only or drop just some bidir frames). + *} + AVDISCARD_NONE = -16, ///< discard nothing + AVDISCARD_DEFAULT = 0, ///< discard useless packets like 0 size packets in avi + AVDISCARD_NONREF = 8, ///< discard all non reference + AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames + AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes + AVDISCARD_ALL = 48 ///< discard all + ); + +{$IF LIBAVCODEC_VERSION >= 52028000} // >= 52.28.0 + TAVColorPrimaries = ( + AVCOL_PRI_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B + AVCOL_PRI_UNSPECIFIED = 2, + AVCOL_PRI_BT470M = 4, + AVCOL_PRI_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM + AVCOL_PRI_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC + AVCOL_PRI_SMPTE240M = 7, ///< functionally identical to above + AVCOL_PRI_FILM = 8, + AVCOL_PRI_NB ///< Not part of ABI + ); + + TAVColorTransferCharacteristic = ( + AVCOL_TRC_BT709 = 1, ///< also ITU-R BT1361 + AVCOL_TRC_UNSPECIFIED = 2, + AVCOL_TRC_GAMMA22 = 4, ///< also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM + AVCOL_TRC_GAMMA28 = 5, ///< also ITU-R BT470BG + AVCOL_TRC_NB ///< Not part of ABI + ); + + TAVColorSpace = ( + AVCOL_SPC_RGB = 0, + AVCOL_SPC_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B + AVCOL_SPC_UNSPECIFIED = 2, + AVCOL_SPC_FCC = 4, + AVCOL_SPC_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601 + AVCOL_SPC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above + AVCOL_SPC_SMPTE240M = 7, + AVCOL_SPC_NB ///< Not part of ABI + ); + + TAVColorRange = ( + AVCOL_RANGE_UNSPECIFIED = 0, + AVCOL_RANGE_MPEG = 1, ///< the normal 219*2^(n-8) "MPEG" YUV ranges + AVCOL_RANGE_JPEG = 2, ///< the normal 2^n-1 "JPEG" YUV ranges + AVCOL_RANGE_NB ///< Not part of ABI + ); + +(** + * X X 3 4 X X are luma samples, + * 1 2 1-6 are possible chroma positions + * X X 5 6 X 0 is undefined/unknown position + *) + TAVChromaLocation = ( + AVCHROMA_LOC_UNSPECIFIED = 0, + AVCHROMA_LOC_LEFT = 1, ///< mpeg2/4, h264 default + AVCHROMA_LOC_CENTER = 2, ///< mpeg1, jpeg, h263 + AVCHROMA_LOC_TOPLEFT = 3, ///< DV + AVCHROMA_LOC_TOP = 4, + AVCHROMA_LOC_BOTTOMLEFT = 5, + AVCHROMA_LOC_BOTTOM = 6, + AVCHROMA_LOC_NB ///< Not part of ABI ); +{$IFEND} PRcOverride = ^TRcOverride; TRcOverride = record {16} - start_frame: cint; - end_frame: cint; - qscale: cint; // if this is 0 then quality_factor will be used instead + start_frame: cint; + end_frame: cint; + qscale: cint; // if this is 0 then quality_factor will be used instead quality_factor: cfloat; end; @@ -655,8 +762,8 @@ type end; const - FF_QSCALE_TYPE_MPEG1 = 0; - FF_QSCALE_TYPE_MPEG2 = 1; + FF_QSCALE_TYPE_MPEG1 = 0; + FF_QSCALE_TYPE_MPEG2 = 1; FF_QSCALE_TYPE_H264 = 2; FF_BUFFER_TYPE_INTERNAL = 1; @@ -678,258 +785,6 @@ const FF_BUFFER_HINTS_PRESERVE = $04; // User must not alter buffer content FF_BUFFER_HINTS_REUSABLE = $08; // Codec will reuse the buffer (update) -type - {** - * Audio Video Frame. - * New fields can be added to the end of FF_COMMON_FRAME with minor version - * bumps. - * Removal, reordering and changes to existing fields require a major - * version bump. No fields should be added into AVFrame before or after - * FF_COMMON_FRAME! - * sizeof(AVFrame) must not be used outside libav*. - *} - PAVFrame = ^TAVFrame; - TAVFrame = record {200} - (** - * pointer to the picture planes. - * This might be different from the first allocated byte - * - encoding: - * - decoding: - *) - data: array [0..3] of pbyte; - linesize: array [0..3] of cint; - (** - * pointer to the first allocated byte of the picture. Can be used in get_buffer/release_buffer. - * This isn't used by libavcodec unless the default get/release_buffer() is used. - * - encoding: - * - decoding: - *) - base: array [0..3] of pbyte; - (** - * 1 -> keyframe, 0-> not - * - encoding: Set by libavcodec. - * - decoding: Set by libavcodec. - *) - key_frame: cint; - (** - * Picture type of the frame, see ?_TYPE below. - * - encoding: Set by libavcodec. for coded_picture (and set by user for input). - * - decoding: Set by libavcodec. - *) - pict_type: cint; - (** - * presentation timestamp in time_base units (time when frame should be shown to user) - * If AV_NOPTS_VALUE then frame_rate = 1/time_base will be assumed. - * - encoding: MUST be set by user. - * - decoding: Set by libavcodec. - *) - pts: cint64; - (**\ - * picture number in bitstream order - * - encoding: set by - * - decoding: Set by libavcodec. - *) - coded_picture_number: cint; - (** - * picture number in display order - * - encoding: set by - * - decoding: Set by libavcodec. - *) - display_picture_number: cint; - (** - * quality (between 1 (good) and FF_LAMBDA_MAX (bad)) - * - encoding: Set by libavcodec. for coded_picture (and set by user for input). - * - decoding: Set by libavcodec. - *) - quality: cint; - (** - * buffer age (1->was last buffer and dint change, 2->..., ...). - * Set to INT_MAX if the buffer has not been used yet. - * - encoding: unused - * - decoding: MUST be set by get_buffer(). - *) - age: cint; - (** - * is this picture used as reference - * The values for this are the same as the MpegEncContext.picture_structure - * variable, that is 1->top field, 2->bottom field, 3->frame/both fields. - * - encoding: unused - * - decoding: Set by libavcodec. (before get_buffer() call)). - *) - reference: cint; - (** - * QP table - * - encoding: unused - * - decoding: Set by libavcodec. - *) - qscale_table: PShortint; - (** - * QP store stride - * - encoding: unused - * - decoding: Set by libavcodec. - *) - qstride: cint; - (** - * mbskip_table[mb]>=1 if MB didn't change - * stride= mb_width = (width+15)>>4 - * - encoding: unused - * - decoding: Set by libavcodec. - *) - mbskip_table: pbyte; - (** - * motion vector table - * @code - * example: - * int mv_sample_log2= 4 - motion_subsample_log2; - * int mb_width= (width+15)>>4; - * int mv_stride= (mb_width << mv_sample_log2) + 1; - * motion_val[direction][x + y*mv_stride][0->mv_x, 1->mv_y]; - * @endcode - * - encoding: Set by user. - * - decoding: Set by libavcodec. - *) - //int16_t (*motion_val[2])[2]; - motion_val: array [0..1] of pointer; - (** - * macroblock type table - * mb_type_base + mb_width + 2 - * - encoding: Set by user. - * - decoding: Set by libavcodec. - *) - mb_type: PCuint; - (** - * log2 of the size of the block which a single vector in motion_val represents: - * (4->16x16, 3->8x8, 2-> 4x4, 1-> 2x2) - * - encoding: unused - * - decoding: Set by libavcodec. - *) - motion_subsample_log2: byte; - (** - * for some private data of the user - * - encoding: unused - * - decoding: Set by user. - *) - opaque: pointer; - (** - * error - * - encoding: Set by libavcodec. if flags&CODEC_FLAG_PSNR. - * - decoding: unused - *) - error: array [0..3] of cuint64; - (** - * type of the buffer (to keep track of who has to deallocate data[*]) - * - encoding: Set by the one who allocates it. - * - decoding: Set by the one who allocates it. - * Note: User allocated (direct rendering) & internal buffers cannot coexist currently. - *) - type_: cint; - (** - * When decoding, this signals how much the picture must be delayed. - * extra_delay = repeat_pict / (2*fps) - * - encoding: unused - * - decoding: Set by libavcodec. - *) - repeat_pict: cint; - (** - * - *) - qscale_type: cint; - (** - * The content of the picture is interlaced. - * - encoding: Set by user. - * - decoding: Set by libavcodec. (default 0) - *) - interlaced_frame: cint; - (** - * If the content is interlaced, is top field displayed first. - * - encoding: Set by user. - * - decoding: Set by libavcodec. - *) - top_field_first: cint; - (** - * Pan scan. - * - encoding: Set by user. - * - decoding: Set by libavcodec. - *) - pan_scan: PAVPanScan; - (** - * Tell user application that palette has changed from previous frame. - * - encoding: ??? (no palette-enabled encoder yet) - * - decoding: Set by libavcodec. (default 0). - *) - palette_has_changed: cint; - (** - * codec suggestion on buffer type if != 0 - * - encoding: unused - * - decoding: Set by libavcodec. (before get_buffer() call)). - *) - buffer_hints: cint; - (** - * DCT coefficients - * - encoding: unused - * - decoding: Set by libavcodec. - *) - dct_coeff: PsmallInt; - (** - * motion referece frame index - * - encoding: Set by user. - * - decoding: Set by libavcodec. - *) - ref_index: array [0..1] of PShortint; - - {$IF LIBAVCODEC_VERSION >= 51068000} // 51.68.0 - (** - * reordered opaque 64bit number (generally a PTS) from AVCodecContext.reordered_opaque - * output in AVFrame.reordered_opaque - * - encoding: unused - * - decoding: Read by user. - *) - reordered_opaque: cint64; - {$IFEND} - - {$IF LIBAVCODEC_VERSION >= 51070000} // 51.70.0 - (** - * Bits per sample/pixel of internal libavcodec pixel/sample format. - * This field is applicable only when sample_fmt is SAMPLE_FMT_S32. - * - encoding: set by user. - * - decoding: set by libavcodec. - *) - bits_per_raw_sample: cint; - {$IFEND} - - {$IF LIBAVCODEC_VERSION >= 52002000} // 52.2.0 - (** - * Audio channel layout. - * - encoding: set by user. - * - decoding: set by libavcodec. - *) - channel_layout: cint64; - - (** - * Request decoder to use this channel layout if it can (0 for default) - * - encoding: unused - * - decoding: Set by user. - *) - request_channel_layout: cint64; - {$IFEND} - - {$IF LIBAVCODEC_VERSION >= 52004000} // 52.4.0 - (** - * Ratecontrol attempt to use, at maximum, of what can be used without an underflow. - * - encoding: Set by user. - * - decoding: unused. - *) - rc_max_available_vbv_use: cfloat; - - (** - * Ratecontrol attempt to use, at least, times the amount needed to prevent a vbv overflow. - * - encoding: Set by user. - * - decoding: unused. - *) - rc_min_vbv_overflow_use: cfloat; - {$IFEND} - end; - const {$IF LIBAVCODEC_VERSION < 52000000} // < 52.0.0 DEFAULT_FRAME_RATE_BASE = 1001000; @@ -1007,12 +862,21 @@ const (* lower 16 bits - CPU features *) FF_MM_MMX = $0001; ///< standard MMX FF_MM_3DNOW = $0004; ///< AMD 3DNOW + {$IF LIBAVCODEC_MAX_VERSION_MAJOR < 53} FF_MM_MMXEXT = $0002; ///< SSE integer functions or AMD MMX ext + {$IFEND} + {$IF LIBAVCODEC_VERSION >= 52024000} // >= 52.24.0 + FF_MM_MMX2 = $0002; ///< SSE integer functions or AMD MMX ext + {$IFEND} FF_MM_SSE = $0008; ///< SSE functions FF_MM_SSE2 = $0010; ///< PIV SSE2 functions FF_MM_3DNOWEXT = $0020; ///< AMD 3DNowExt FF_MM_SSE3 = $0040; ///< Prescott SSE3 functions FF_MM_SSSE3 = $0080; ///< Conroe SSSE3 functions + {$IF LIBAVCODEC_VERSION >= 52022003} // >= 52.22.3 + FF_MM_SSE4 = $0100; ///< Penryn SSE4.1 functions + FF_MM_SSE42 = $0200; ///< Nehalem SSE4.2 functions + {$IFEND} FF_MM_IWMMXT = $0100; ///< XScale IWMMXT FF_MM_ALTIVEC = $0001; ///< standard AltiVec @@ -1100,62 +964,461 @@ const FF_PROFILE_AAC_SSR = 2; FF_PROFILE_AAC_LTP = 3; - FF_LEVEL_UNKNOWN = -99; + FF_LEVEL_UNKNOWN = -99; + + X264_PART_I4X4 = $001; (* Analyse i4x4 *) + X264_PART_I8X8 = $002; (* Analyse i8x8 (requires 8x8 transform) *) + X264_PART_P8X8 = $010; (* Analyse p16x8, p8x16 and p8x8 *) + X264_PART_P4X4 = $020; (* Analyse p8x4, p4x8, p4x4 *) + X264_PART_B8X8 = $100; (* Analyse b16x8, b8x16 and b8x8 *) + + FF_COMPRESSION_DEFAULT = -1; + +const + AVPALETTE_SIZE = 1024; + AVPALETTE_COUNT = 256; + +{$IF LIBAVCODEC_MAX_VERSION_MAJOR < 53} +type +(** + * AVPaletteControl + * This structure defines a method for communicating palette changes + * between and demuxer and a decoder. + * + * @deprecated Use AVPacket to send palette changes instead. + * This is totally broken. + *) + PAVPaletteControl = ^TAVPaletteControl; + TAVPaletteControl = record + (* demuxer sets this to 1 to indicate the palette has changed; + * decoder resets to 0 *) + palette_changed: cint; + + (* 4-byte ARGB palette entries, stored in native byte order; note that + * the individual palette components should be on a 8-bit scale; if + * the palette data comes from a IBM VGA native format, the component + * data is probably 6 bits in size and needs to be scaled *) + palette: array [0..AVPALETTE_COUNT - 1] of cuint; + end; {deprecated;} +{$IFEND} + +{$IF LIBAVCODEC_VERSION >= 52023000} // >= 52.23.0 +type + PAVPacket = ^TAVPacket; + TAVPacket = record +(* + * Presentation timestamp in AVStream->time_base units; the time at which + * the decompressed packet will be presented to the user. + * Can be AV_NOPTS_VALUE if it is not stored in the file. + * pts MUST be larger or equal to dts as presentation cannot happen before + * decompression, unless one wants to view hex dumps. Some formats misuse + * the terms dts and pts/cts to mean something different. Such timestamps + * must be converted to true pts/dts before they are stored in AVPacket. + *) + pts: cint64; +(* + * Decompression timestamp in AVStream->time_base units; the time at which + * the packet is decompressed. + * Can be AV_NOPTS_VALUE if it is not stored in the file. + *) + dts: cint64; + data: PByteArray; + size: cint; + stream_index: cint; + flags: cint; +(* + * Duration of this packet in AVStream->time_base units, 0 if unknown. + * Equals next_pts - this_pts in presentation order. + *) + duration: cint; + destruct: procedure (para1: PAVPacket); cdecl; + priv: pointer; + pos: cint64; // byte position in stream, -1 if unknown + +(* + * Time difference in AVStream->time_base units from the pts of this + * packet to the point at which the output from the decoder has converged + * independent from the availability of previous frames. That is, the + * frames are virtually identical no matter if decoding started from + * the very first frame or from this keyframe. + * Is AV_NOPTS_VALUE if unknown. + * This field is not the display duration of the current packet. + * + * The purpose of this field is to allow seeking in streams that have no + * keyframes in the conventional sense. It corresponds to the + * recovery point SEI in H.264 and match_time_delta in NUT. It is also + * essential for some types of subtitle streams to ensure that all + * subtitles are correctly displayed after seeking. + *) + convergence_duration: cint64; + end; + +const + {$IF LIBAVCODEC_VERSION >= 52030002} // >= 52.30.2 + PKT_FLAG_KEY = $0001; + {$ELSE} + AV_PKT_FLAG_KEY = $0001; + {$IF LIBAVCODEC_VERSION_MAJOR < 53} + PKT_FLAG_KEY = AV_PKT_FLAG_KEY; + {$IFEND} + {$IFEND} +{$IFEND} + +type + PAVClass = ^TAVClass; {const} + PAVCodecContext = ^TAVCodecContext; + + PAVCodec = ^TAVCodec; + +{$IF LIBAVCODEC_VERSION >= 52018000} // >= 52.18.0 + PAVHWAccel = ^TAVHWAccel; +{$IFEND} + + // int[4] + PQuadIntArray = ^TQuadIntArray; + TQuadIntArray = array[0..3] of cint; + // int (*func)(struct AVCodecContext *c2, void *arg) + TExecuteFunc = function(c2: PAVCodecContext; arg: Pointer): cint; cdecl; + + TAVClass = record + class_name: PAnsiChar; + (* actually passing a pointer to an AVCodecContext + or AVFormatContext, which begin with an AVClass. + Needed because av_log is in libavcodec and has no visibility + of AVIn/OutputFormat *) + item_name: function(): PAnsiChar; cdecl; + option: PAVOption; + end; + + {** + * Audio Video Frame. + * New fields can be added to the end of FF_COMMON_FRAME with minor version + * bumps. + * Removal, reordering and changes to existing fields require a major + * version bump. No fields should be added into AVFrame before or after + * FF_COMMON_FRAME! + * sizeof(AVFrame) must not be used outside libav*. + *} + PAVFrame = ^TAVFrame; + TAVFrame = record {200} + (** + * pointer to the picture planes. + * This might be different from the first allocated byte + * - encoding: + * - decoding: + *) + data: array [0..3] of pbyte; + linesize: array [0..3] of cint; + (** + * pointer to the first allocated byte of the picture. Can be used in get_buffer/release_buffer. + * This isn't used by libavcodec unless the default get/release_buffer() is used. + * - encoding: + * - decoding: + *) + base: array [0..3] of pbyte; + (** + * 1 -> keyframe, 0-> not + * - encoding: Set by libavcodec. + * - decoding: Set by libavcodec. + *) + key_frame: cint; + (** + * Picture type of the frame, see ?_TYPE below. + * - encoding: Set by libavcodec. for coded_picture (and set by user for input). + * - decoding: Set by libavcodec. + *) + pict_type: cint; + (** + * presentation timestamp in time_base units (time when frame should be shown to user) + * If AV_NOPTS_VALUE then frame_rate = 1/time_base will be assumed. + * - encoding: MUST be set by user. + * - decoding: Set by libavcodec. + *) + pts: cint64; + (** + * picture number in bitstream order + * - encoding: set by + * - decoding: Set by libavcodec. + *) + coded_picture_number: cint; + (** + * picture number in display order + * - encoding: set by + * - decoding: Set by libavcodec. + *) + display_picture_number: cint; + (** + * quality (between 1 (good) and FF_LAMBDA_MAX (bad)) + * - encoding: Set by libavcodec. for coded_picture (and set by user for input). + * - decoding: Set by libavcodec. + *) + quality: cint; + (** + * buffer age (1->was last buffer and dint change, 2->..., ...). + * Set to INT_MAX if the buffer has not been used yet. + * - encoding: unused + * - decoding: MUST be set by get_buffer(). + *) + age: cint; + (** + * is this picture used as reference + * The values for this are the same as the MpegEncContext.picture_structure + * variable, that is 1->top field, 2->bottom field, 3->frame/both fields. + * Set to 4 for delayed, non-reference frames. + * - encoding: unused + * - decoding: Set by libavcodec. (before get_buffer() call)). + *) + reference: cint; + (** + * QP table + * - encoding: unused + * - decoding: Set by libavcodec. + *) + qscale_table: PShortint; + (** + * QP store stride + * - encoding: unused + * - decoding: Set by libavcodec. + *) + qstride: cint; + (** + * mbskip_table[mb]>=1 if MB didn't change + * stride= mb_width = (width+15)>>4 + * - encoding: unused + * - decoding: Set by libavcodec. + *) + mbskip_table: pbyte; + (** + * motion vector table + * @code + * example: + * int mv_sample_log2= 4 - motion_subsample_log2; + * int mb_width= (width+15)>>4; + * int mv_stride= (mb_width << mv_sample_log2) + 1; + * motion_val[direction][x + y*mv_stride][0->mv_x, 1->mv_y]; + * @endcode + * - encoding: Set by user. + * - decoding: Set by libavcodec. + *) + //int16_t (*motion_val[2])[2]; + motion_val: array [0..1] of pointer; + (** + * macroblock type table + * mb_type_base + mb_width + 2 + * - encoding: Set by user. + * - decoding: Set by libavcodec. + *) + mb_type: PCuint; + (** + * log2 of the size of the block which a single vector in motion_val represents: + * (4->16x16, 3->8x8, 2-> 4x4, 1-> 2x2) + * - encoding: unused + * - decoding: Set by libavcodec. + *) + motion_subsample_log2: byte; + (** + * for some private data of the user + * - encoding: unused + * - decoding: Set by user. + *) + opaque: pointer; + (** + * error + * - encoding: Set by libavcodec. if flags&CODEC_FLAG_PSNR. + * - decoding: unused + *) + error: array [0..3] of cuint64; + (** + * type of the buffer (to keep track of who has to deallocate data[*]) + * - encoding: Set by the one who allocates it. + * - decoding: Set by the one who allocates it. + * Note: User allocated (direct rendering) & internal buffers cannot coexist currently. + *) + type_: cint; + (** + * When decoding, this signals how much the picture must be delayed. + * extra_delay = repeat_pict / (2*fps) + * - encoding: unused + * - decoding: Set by libavcodec. + *) + repeat_pict: cint; + (** + * + *) + qscale_type: cint; + (** + * The content of the picture is interlaced. + * - encoding: Set by user. + * - decoding: Set by libavcodec. (default 0) + *) + interlaced_frame: cint; + (** + * If the content is interlaced, is top field displayed first. + * - encoding: Set by user. + * - decoding: Set by libavcodec. + *) + top_field_first: cint; + (** + * Pan scan. + * - encoding: Set by user. + * - decoding: Set by libavcodec. + *) + pan_scan: PAVPanScan; + (** + * Tell user application that palette has changed from previous frame. + * - encoding: ??? (no palette-enabled encoder yet) + * - decoding: Set by libavcodec. (default 0). + *) + palette_has_changed: cint; + (** + * codec suggestion on buffer type if != 0 + * - encoding: unused + * - decoding: Set by libavcodec. (before get_buffer() call)). + *) + buffer_hints: cint; + (** + * DCT coefficients + * - encoding: unused + * - decoding: Set by libavcodec. + *) + dct_coeff: PsmallInt; + (** + * motion referece frame index + * - encoding: Set by user. + * - decoding: Set by libavcodec. + *) + ref_index: array [0..1] of PShortint; + + {$IF LIBAVCODEC_VERSION >= 51068000} // >= 51.68.0 + (** + * reordered opaque 64bit number (generally a PTS) from AVCodecContext.reordered_opaque + * output in AVFrame.reordered_opaque + * - encoding: unused + * - decoding: Read by user. + *) + reordered_opaque: cint64; + {$IFEND} + + {$IF LIBAVCODEC_VERSION = 52021000} // = 52.21.0 + (** + * hardware accelerator private data (FFmpeg allocated) + * - encoding: unused + * - decoding: Set by libavcodec + *) + hwaccel_data_private: pointer; + {$IFEND} + {$IF LIBAVCODEC_VERSION >= 52022000} // >= 52.22.0 + hwaccel_picture_private: pointer; + {$IFEND} - X264_PART_I4X4 = $001; (* Analyse i4x4 *) - X264_PART_I8X8 = $002; (* Analyse i8x8 (requires 8x8 transform) *) - X264_PART_P8X8 = $010; (* Analyse p16x8, p8x16 and p8x8 *) - X264_PART_P4X4 = $020; (* Analyse p8x4, p4x8, p4x4 *) - X264_PART_B8X8 = $100; (* Analyse b16x8, b8x16 and b8x8 *) + {$IF LIBAVCODEC_VERSION >= 51070000} // >= 51.70.0 + (** + * Bits per sample/pixel of internal libavcodec pixel/sample format. + * This field is applicable only when sample_fmt is SAMPLE_FMT_S32. + * - encoding: set by user. + * - decoding: set by libavcodec. + *) + bits_per_raw_sample: cint; + {$IFEND} - FF_COMPRESSION_DEFAULT = -1; + {$IF LIBAVCODEC_VERSION >= 52002000} // >= 52.2.0 + (** + * Audio channel layout. + * - encoding: set by user. + * - decoding: set by libavcodec. + *) + channel_layout: cint64; -const - AVPALETTE_SIZE = 1024; - AVPALETTE_COUNT = 256; + (** + * Request decoder to use this channel layout if it can (0 for default) + * - encoding: unused + * - decoding: Set by user. + *) + request_channel_layout: cint64; + {$IFEND} -type -(** - * AVPaletteControl - * This structure defines a method for communicating palette changes - * between and demuxer and a decoder. - * - * @deprecated Use AVPacket to send palette changes instead. - * This is totally broken. - *) - PAVPaletteControl = ^TAVPaletteControl; - TAVPaletteControl = record - (* demuxer sets this to 1 to indicate the palette has changed; - * decoder resets to 0 *) - palette_changed: cint; + {$IF LIBAVCODEC_VERSION >= 52004000} // >= 52.4.0 + (** + * Ratecontrol attempt to use, at maximum, of what can be used without an underflow. + * - encoding: Set by user. + * - decoding: unused. + *) + rc_max_available_vbv_use: cfloat; - (* 4-byte ARGB palette entries, stored in native byte order; note that - * the individual palette components should be on a 8-bit scale; if - * the palette data comes from a IBM VGA native format, the component - * data is probably 6 bits in size and needs to be scaled *) - palette: array [0..AVPALETTE_COUNT - 1] of cuint; - end; {deprecated;} + (** + * Ratecontrol attempt to use, at least, times the amount needed to prevent a vbv overflow. + * - encoding: Set by user. + * - decoding: unused. + *) + rc_min_vbv_overflow_use: cfloat; + {$IFEND} + {$IF LIBAVCODEC_VERSION >= 52018000} // >= 52.18.0 + (** + * Hardware accelerator in use + * - encoding: unused. + * - decoding: Set by libavcodec + *) + hwaccel: PAVHWAccel; + {$IFEND} + {$IF LIBAVCODEC_VERSION >= 52020000} // >= 52.20.0 + (** + * For some codecs, the time base is closer to the field rate than the frame rate. + * Most notably, H.264 and MPEG-2 specify time_base as half of frame duration + * if no telecine is used ... + * + * Set to time_base ticks per frame. Default 1, e.g., H.264/MPEG-2 set it to 2. + *) + ticks_per_frame: cint; + {$IFEND} + {$IF LIBAVCODEC_VERSION >= 52021000} // >= 52.21.0 + (** + * Hardware accelerator context. + * For some hardware accelerators, a global context needs to be + * provided by the user. In that case, this holds display-dependent + * data FFmpeg cannot instantiate itself. Please refer to the + * FFmpeg HW accelerator documentation to know how to fill this + * is. e.g. for VA API, this is a struct vaapi_context. + * - encoding: unused + * - decoding: Set by user + *) + hwaccel_context: pointer; + {$IFEND} + {$IF LIBAVCODEC_VERSION >= 52028000} // >= 52.28.0 + (** + * Chromaticity coordinates of the source primaries. + * - encoding: Set by user + * - decoding: Set by libavcodec + *) + color_primaries: TAVColorPrimaries; -type - PAVClass = ^TAVClass; {const} - PAVCodecContext = ^TAVCodecContext; + (** + * Color Transfer Characteristic. + * - encoding: Set by user + * - decoding: Set by libavcodec + *) + color_trc: TAVColorTransferCharacteristic; - PAVCodec = ^TAVCodec; + (** + * YUV colorspace type. + * - encoding: Set by user + * - decoding: Set by libavcodec + *) + colorspace: TAVColorSpace; - // int[4] - PQuadIntArray = ^TQuadIntArray; - TQuadIntArray = array[0..3] of cint; - // int (*func)(struct AVCodecContext *c2, void *arg) - TExecuteFunc = function(c2: PAVCodecContext; arg: Pointer): cint; cdecl; + (** + * MPEG vs JPEG YUV range. + * - encoding: Set by user + * - decoding: Set by libavcodec + *) + color_range: TAVColorRange; - TAVClass = record - class_name: PAnsiChar; - (* actually passing a pointer to an AVCodecContext - or AVFormatContext, which begin with an AVClass. - Needed because av_log is in libavcodec and has no visibility - of AVIn/OutputFormat *) - item_name: function(): PAnsiChar; cdecl; - option: PAVOption; + (** + * This defines the location of chroma samples. + * - encoding: Set by user + * - decoding: Set by libavcodec + *) + chroma_sample_location: TAVChromaLocation; + {$IFEND} end; (** @@ -1273,6 +1536,13 @@ type * decoder to draw a horizontal band. It improves cache usage. Not * all codecs can do that. You must check the codec capabilities * beforehand. + * The function is also used by hardware acceleration APIs. + * It is called at least once during frame decoding to pass + * the data needed for hardware render. + * In that mode instead of pixel data, AVFrame points to + * a structure specific to the acceleration API. The application + * reads the structure and can change some fields to indicate progress + * or mark state. * - encoding: unused * - decoding: Set by user. * @param height the height of the slice @@ -1301,7 +1571,9 @@ type *) frame_size: cint; frame_number: cint; ///< audio or video frame number +{$IF LIBAVCODEC_MAX_VERSION_MAJOR < 53} real_pict_num: cint; ///< returns the real picture number of previous encoded frame +{$IFEND} (** * Number of frames the decoded output will be delayed relative to @@ -1490,6 +1762,9 @@ type * If pic.reference is set then the frame will be read later by libavcodec. * avcodec_align_dimensions() should be used to find the required width and * height, as they normally need to be rounded up to the next multiple of 16. + * if CODEC_CAP_DR1 is not set then get_buffer() must call + * avcodec_default_get_buffer() instead of providing buffers allocated by + * some other means. * - encoding: unused * - decoding: Set by libavcodec., user can override. *) @@ -1505,7 +1780,8 @@ type release_buffer: procedure (c: PAVCodecContext; pic: PAVFrame); cdecl; (** - * If 1 the stream has a 1 frame delay during decoding. + * Size of the frame reordering buffer in the decoder. + * For MPEG-2 it is 1 IPB or 0 low delay IP. * - encoding: Set by libavcodec. * - decoding: Set by libavcodec. *) @@ -2012,6 +2288,9 @@ type * libavcodec will pass previous buffer in pic, function should return * same buffer or new buffer with old frame "painted" into it. * If pic.data[0] == NULL must behave like get_buffer(). + * if CODEC_CAP_DR1 is not set then reget_buffer() must call + * avcodec_default_reget_buffer() instead of providing buffers allocated by + * some other means. * - encoding: unused * - decoding: Set by libavcodec., user can override *) @@ -2465,6 +2744,15 @@ type *) reordered_opaque: cint64; {$IFEND} + + {$IF LIBAVCODEC_VERSION >= 52028000} // 52.28.0 + (** + * This defines the location of chroma samples. + * - encoding: Set by user + * - decoding: Set by libavcodec + *) + chroma_sample_location: TAVChromaLocation; + {$IFEND} end; (** @@ -2479,37 +2767,140 @@ type encode: function (avctx: PAVCodecContext; buf: PByteArray; buf_size: cint; data: pointer): cint; cdecl; close: function (avctx: PAVCodecContext): cint; cdecl; decode: function (avctx: PAVCodecContext; outdata: pointer; var outdata_size: cint; + {$IF LIBAVCODEC_VERSION < 52025000} // 52.25.0 buf: {const} PByteArray; buf_size: cint): cint; cdecl; + {$ELSE} + avpkt: PAVPacket): cint; cdecl; + {$IFEND} + (** + * Codec capabilities. + * see CODEC_CAP_* + *) + capabilities: cint; + next: PAVCodec; + (** + * Flush buffers. + * Will be called when seeking + *) + flush: procedure (avctx: PAVCodecContext); cdecl; + supported_framerates: {const} PAVRational; ///< array of supported framerates, or NULL if any, array is terminated by {0,0} + pix_fmts: {const} PAVPixelFormat; ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1 + {$IF LIBAVCODEC_VERSION >= 51055000} // 51.55.0 + (** + * Descriptive name for the codec, meant to be more human readable than name. + * You should use the NULL_IF_CONFIG_SMALL() macro to define it. + *) + long_name: {const} PAnsiChar; + {$IFEND} + {$IF LIBAVCODEC_VERSION >= 51056000} // 51.56.0 + supported_samplerates: {const} PCint; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0 + {$IFEND} + {$IF LIBAVCODEC_VERSION >= 51062000} // 51.62.0 + sample_fmts: {const} PSampleFormatArray; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1 + {$IFEND} + {$IF LIBAVCODEC_VERSION >= 52002000} // 52.2.0 + channel_layouts: {const} PCint64; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0 + {$IFEND} + end; + +{$IF LIBAVCODEC_VERSION >= 52018000} // 52.18.0 +(** + * AVHWAccel. + *) + TAVHWAccel = record + (** + * Name of the hardware accelerated codec. + * The name is globally unique among encoders and among decoders (but an + * encoder and a decoder can share the same name). + *) + name: PAnsiChar; + + (** + * Type of codec implemented by the hardware accelerator. + * + * See CODEC_TYPE_xxx + *) + type_: TCodecType; + (** - * Codec capabilities. - * see CODEC_CAP_* + * Codec implemented by the hardware accelerator. + * + * See CODEC_ID_xxx + *) + id: TCodecID; + + (** + * Supported pixel format. + * + * Only hardware accelerated formats are supported here. + *) + pix_fmt: {const} PAVPixelFormat; + + (** + * Hardware accelerated codec capabilities. + * see FF_HWACCEL_CODEC_CAP_* *) capabilities: cint; + next: PAVCodec; + (** - * Flush buffers. - * Will be called when seeking + * Called at the beginning of each frame or field picture. + * + * Meaningful frame information (codec specific) is guaranteed to + * be parsed at this point. This function is mandatory. + * + * Note that buf can be NULL along with buf_size set to 0. + * Otherwise, this means the whole frame is available at this point. + * + * @param avctx the codec context + * @param buf the frame data buffer base + * @param buf_size the size of the frame in bytes + * @return zero if successful, a negative value otherwise *) - flush: procedure (avctx: PAVCodecContext); cdecl; - supported_framerates: {const} PAVRational; ///< array of supported framerates, or NULL if any, array is terminated by {0,0} - pix_fmts: {const} PAVPixelFormat; ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1 - {$IF LIBAVCODEC_VERSION >= 51055000} // 51.55.0 + start_frame: function (avctx: PAVCodecContext; + buf: PByteArray; + buf_size: cint): cint; cdecl; + (** - * Descriptive name for the codec, meant to be more human readable than \p name. - * You \e should use the NULL_IF_CONFIG_SMALL() macro to define it. + * Callback for each slice. + * + * Meaningful slice information (codec specific) is guaranteed to + * be parsed at this point. This function is mandatory. + * + * @param avctx the codec context + * @param buf the slice data buffer base + * @param buf_size the size of the slice in bytes + * @return zero if successful, a negative value otherwise *) - long_name: {const} PAnsiChar; - {$IFEND} - {$IF LIBAVCODEC_VERSION >= 51056000} // 51.56.0 - supported_samplerates: {const} PCint; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0 - {$IFEND} - {$IF LIBAVCODEC_VERSION >= 51062000} // 51.62.0 - sample_fmts: {const} PSampleFormatArray; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1 - {$IFEND} - {$IF LIBAVCODEC_VERSION >= 52002000} // 52.2.0 - channel_layouts: {const} PCint64; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0 - {$IFEND} + decode_slice: function (avctx: PAVCodecContext; + buf: PByteArray; + buf_size: cint): cint; cdecl; + + (** + * Called at the end of each frame or field picture. + * + * The whole picture is parsed at this point and can now be sent + * to the hardware accelerator. This function is mandatory. + * + * @param avctx the codec context + * @return zero if successful, a negative value otherwise + *) + end_frame: function (avctx: PAVCodecContext): cint; cdecl; + +{$IF LIBAVCODEC_VERSION >= 52021000} // >= 52.21.0 + (** + * Size of HW accelerator private data. + * + * Private data is allocated with av_mallocz() before + * AVCodecContext.get_buffer() and deallocated after + * AVCodecContext.release_buffer(). + *) + priv_data_size: cint; +{$IFEND} + end; +{$IFEND} (** * four components are given, that's all. @@ -2594,9 +2985,69 @@ type {$IFEND} end; +{$IF LIBAVCODEC_VERSION >= 52025000} // 52.25.0 +{ packet functions } -(* resample.c *) +(** + * @deprecated use NULL instead + *) +procedure av_destruct_packet_nofree(pkt: PAVPacket); + cdecl; external av__codec; + +(* + * Default packet destructor. + *) +procedure av_destruct_packet(pkt: PAVPacket); + cdecl; external av__codec; + +(* + * Initialize optional fields of a packet with default values. + * + * @param pkt packet + *) +procedure av_init_packet(pkt: PAVPacket); + cdecl; external av__codec; + +(* + * Allocate the payload of a packet and initialize its fields with + * default values. + * + * @param pkt packet + * @param size wanted payload size + * @return 0 if OK, AVERROR_xxx otherwise + *) +function av_new_packet(pkt: PAVPacket; size: cint): cint; + cdecl; external av__codec; + +(* + * Reduce packet size, correctly zeroing padding + * + * @param pkt packet + * @param size new size + *) +procedure av_shrink_packet(pkt: PAVPacket; size: cint); + cdecl; external av__codec; + +(* + * @warning This is a hack - the packet memory allocation stuff is broken. The + * packet is allocated if it was not really allocated. + *) +function av_dup_packet(pkt: PAVPacket): cint; + cdecl; external av__codec; + +(* + * Free a packet. + * + * @param pkt packet to free + *) +procedure av_free_packet(pkt: PAVPacket); +{$IF LIBAVCODEC_VERSION >= 52028000} // 52.28.0 + cdecl; external av__codec; +{$IFEND} +{$IFEND} +(* resample.c *) +type PReSampleContext = pointer; PAVResampleContext = pointer; PImgReSampleContext = pointer; @@ -2611,15 +3062,44 @@ function audio_resample (s: PReSampleContext; output: PSmallint; input: PSmallin procedure audio_resample_close (s: PReSampleContext); cdecl; external av__codec; - +(** + * Initializes an audio resampler. + * Note, if either rate is not an integer then simply scale both rates up so they are. + * @param filter_length length of each FIR filter in the filterbank relative to the cutoff freq + * @param log2_phase_count log2 of the number of entries in the polyphase filterbank + * @param linear If 1 then the used FIR filter will be linearly interpolated + between the 2 closest, if 0 the closest will be used + * @param cutoff cutoff frequency, 1.0 corresponds to half the output sampling rate + *) function av_resample_init (out_rate: cint; in_rate: cint; filter_length: cint; log2_phase_count: cint; linear: cint; cutoff: cdouble): PAVResampleContext; cdecl; external av__codec; +(** + * resamples. + * @param src an array of unconsumed samples + * @param consumed the number of samples of src which have been consumed are returned here + * @param src_size the number of unconsumed samples available + * @param dst_size the amount of space in samples available in dst + * @param update_ctx If this is 0 then the context will not be modified, that way several channels can be resampled with the same context. + * @return the number of samples written in dst or -1 if an error occurred + *) function av_resample (c: PAVResampleContext; dst: PSmallint; src: PSmallint; var consumed: cint; src_size: cint; dst_size: cint; update_ctx: cint): cint; cdecl; external av__codec; +(** + * Compensates samplerate/timestamp drift. The compensation is done by changing + * the resampler parameters, so no audible clicks or similar distortions occur + * @param compensation_distance distance in output samples over which the compensation should be performed + * @param sample_delta number of output samples which should be output less + * + * example: av_resample_compensate(c, 10, 500) + * here instead of 510 samples only 500 samples would be output + * + * note, due to rounding the actual compensation might be slightly different, + * especially if the compensation_distance is large and the in_rate used during init is small + *) procedure av_resample_compensate (c: PAVResampleContext; sample_delta: cint; compensation_distance: cint); cdecl; external av__codec; @@ -2627,7 +3107,6 @@ procedure av_resample_compensate (c: PAVResampleContext; sample_delta: cint; procedure av_resample_close (c: PAVResampleContext); cdecl; external av__codec; - {$IF LIBAVCODEC_VERSION < 52000000} // 52.0.0 (* YUV420 format is assumed ! *) @@ -2660,7 +3139,6 @@ procedure img_resample (s: PImgReSampleContext; output: PAVPicture; input: {cons *) procedure img_resample_close (s: PImgReSampleContext); cdecl; external av__codec; deprecated; - {$IFEND} (** @@ -2692,6 +3170,7 @@ procedure avpicture_free (picture: PAVPicture); * If a planar format is specified, several pointers will be set pointing to * the different picture planes and the line sizes of the different planes * will be stored in the lines_sizes array. + * Call with ptr == NULL to get the required size for the ptr buffer. * * @param picture AVPicture whose fields are to be filled in * @param ptr Buffer which will contain or contains the actual image data @@ -2712,11 +3191,14 @@ function avpicture_layout (src: {const} PAVPicture; pix_fmt: TAVPixelFormat; (** * Calculate the size in bytes that a picture of the given width and height * would occupy if stored in the given picture format. + * Note that this returns the size of a compact representation as generated + * by avpicture_layout, which can be smaller than the size required for e.g. + * avpicture_fill. * * @param pix_fmt the given picture format * @param width the width of the image * @param height the height of the image - * @return Image data size in bytes + * @return Image data size in bytes or -1 on error (e.g. too large dimensions). *) function avpicture_get_size (pix_fmt: TAVPixelFormat; width: cint; height: cint): cint; cdecl; external av__codec; @@ -2724,12 +3206,34 @@ function avpicture_get_size (pix_fmt: TAVPixelFormat; width: cint; height: cint) procedure avcodec_get_chroma_sub_sample (pix_fmt: TAVPixelFormat; var h_shift: cint; var v_shift: cint); cdecl; external av__codec; +(** + * Returns the pixel format corresponding to the name \p name. + * + * If there is no pixel format with name \p name, then looks for a + * pixel format with the name corresponding to the native endian + * format of \p name. + * For example in a little-endian system, first looks for "gray16", + * then for "gray16le". + * + * Finally if no pixel format has been found, returns \c PIX_FMT_NONE. + *) function avcodec_get_pix_fmt_name(pix_fmt: TAVPixelFormat): PAnsiChar; cdecl; external av__codec; procedure avcodec_set_dimensions(s: PAVCodecContext; width: cint; height: cint); cdecl; external av__codec; +(** + * Returns the pixel format corresponding to the name name. + * + * If there is no pixel format with name name, then looks for a + * pixel format with the name corresponding to the native endian + * format of name. + * For example in a little-endian system, first looks for "gray16", + * then for "gray16le". + * + * Finally if no pixel format has been found, returns PIX_FMT_NONE. + *) function avcodec_get_pix_fmt(name: {const} PAnsiChar): TAVPixelFormat; cdecl; external av__codec; @@ -2773,7 +3277,7 @@ function avcodec_get_pix_fmt_loss (dst_pix_fmt: TAVPixelFormat; src_pix_fmt: TAV * some formats to other formats. avcodec_find_best_pix_fmt() searches which of * the given pixel formats should be used to suffer the least amount of loss. * The pixel formats from which it chooses one, are determined by the - * \p pix_fmt_mask parameter. + * pix_fmt_mask parameter. * * @code * src_pix_fmt = PIX_FMT_YUV420P; @@ -2791,10 +3295,14 @@ function avcodec_get_pix_fmt_loss (dst_pix_fmt: TAVPixelFormat; src_pix_fmt: TAV function avcodec_find_best_pix_fmt(pix_fmt_mask: cint64; src_pix_fmt: TAVPixelFormat; has_alpha: cint; loss_ptr: PCint): cint; cdecl; external av__codec; -{$ELSE} +{$ELSEIF LIBAVCODEC_VERSION < 52022001} function avcodec_find_best_pix_fmt(pix_fmt_mask: cint; src_pix_fmt: TAVPixelFormat; has_alpha: cint; loss_ptr: PCint): cint; cdecl; external av__codec; +{$ELSE} +function avcodec_find_best_pix_fmt(pix_fmt_mask: cint; src_pix_fmt: TAVPixelFormat; + has_alpha: cint; loss_ptr: PCint): TAVPixelFormat; + cdecl; external av__codec; {$IFEND} {$IF LIBAVCODEC_VERSION >= 51041000} // 51.41.0 @@ -2808,8 +3316,13 @@ function avcodec_find_best_pix_fmt(pix_fmt_mask: cint; src_pix_fmt: TAVPixelForm * a negative value to print the corresponding header. * Meaningful values for obtaining a pixel format info vary from 0 to PIX_FMT_NB -1. *) +{$IF LIBAVCODEC_VERSION < 52022001} // 52.22.1 procedure avcodec_pix_fmt_string (buf: PAnsiChar; buf_size: cint; pix_fmt: cint); cdecl; external av__codec; +{$ELSE} +procedure avcodec_pix_fmt_string (buf: PAnsiChar; buf_size: cint; pix_fmt: TAVPixelFormat); + cdecl; external av__codec; +{$IFEND} {$IFEND} const @@ -2822,7 +3335,8 @@ const *) function img_get_alpha_info (src: {const} PAVPicture; pix_fmt: TAVPixelFormat; - width: cint; height: cint): cint; + width: cint; + height: cint): cint; cdecl; external av__codec; {$IF LIBAVCODEC_VERSION < 52000000} // 52.0.0 @@ -2838,8 +3352,11 @@ function img_convert (dst: PAVPicture; dst_pix_fmt: TAVPixelFormat; (* deinterlace a picture *) (* deinterlace - if not supported return -1 *) -function avpicture_deinterlace (dst: PAVPicture; src: {const} PAVPicture; - pix_fmt: TAVPixelFormat; width: cint; height: cint): cint; +function avpicture_deinterlace (dst: PAVPicture; + src: {const} PAVPicture; + pix_fmt: TAVPixelFormat; + width: cint; + height: cint): cint; cdecl; external av__codec; {* external high level API *} @@ -2852,6 +3369,11 @@ var {$IFEND} {$IF LIBAVCODEC_VERSION >= 51049000} // 51.49.0 +(** + * If c is NULL, returns the first registered codec, + * if c is non-NULL, returns the next registered codec after c, + * or NULL if c is the last one. + *) function av_codec_next(c: PAVCodec): PAVCodec; cdecl; external av__codec; {$IFEND} @@ -2871,20 +3393,27 @@ function avcodec_build(): cuint; (** * Initializes libavcodec. * - * @warning This function \e must be called before any other libavcodec + * @warning This function must be called before any other libavcodec * function. *) procedure avcodec_init(); cdecl; external av__codec; (** - * Register the codec \p codec and initialize libavcodec. + * Register the codec codec and initialize libavcodec. * * @see avcodec_init() *) +{$IF LIBAVCODEC_VERSION >= 52014000} // 52.14.0 +procedure avcodec_register(codec: PAVCodec); + cdecl; external av__codec; +// Deprecated in favor of avcodec_register. +procedure register_avcodec(codec: PAVCodec); + cdecl; external av__codec; deprecated; +{$ELSEIF LIBAVCODEC_VERSION_MAJOR < 53} procedure register_avcodec(codec: PAVCodec); cdecl; external av__codec; - +{$IFEND} (** * Finds a registered encoder with a matching codec ID. * @@ -3050,125 +3579,189 @@ function avcodec_open(avctx: PAVCodecContext; codec: PAVCodec): cint; {$IF LIBAVCODEC_VERSION < 52000000} // < 52.0.0 (** - * @deprecated Use avcodec_decode_audio2() instead. + * @deprecated Use avcodec_decode_audio2 instead. *) function avcodec_decode_audio(avctx: PAVCodecContext; samples: PSmallint; var frame_size_ptr: cint; buf: {const} PByteArray; buf_size: cint): cint; - cdecl; external av__codec; + cdecl; external av__codec; {deprecated;} {$IFEND} +{$IF LIBAVCODEC_MAX_VERSION_MAJOR < 53} {$IF LIBAVCODEC_VERSION >= 51030000} // 51.30.0 (** - * Decodes an audio frame from \p buf into \p samples. - * The avcodec_decode_audio2() function decodes an audio frame from the input - * buffer \p buf of size \p buf_size. To decode it, it makes use of the - * audio codec which was coupled with \p avctx using avcodec_open(). The - * resulting decoded frame is stored in output buffer \p samples. If no frame - * could be decompressed, \p frame_size_ptr is zero. Otherwise, it is the - * decompressed frame size in \e bytes. + * Decodes an audio frame from buf into samples. + * Wrapper function which calls avcodec_decode_audio3. + * + * @deprecated Use avcodec_decode_audio3 instead. + * @param avctx the codec context + * @param[out] samples the output buffer + * @param[in,out] frame_size_ptr the output buffer size in bytes + * @param[in] buf the input buffer + * @param[in] buf_size the input buffer size in bytes + * @return On error a negative value is returned, otherwise the number of bytes + * used or zero if no frame could be decompressed. + *) +function avcodec_decode_audio2(avctx: PAVCodecContext; samples: PSmallint; + var frame_size_ptr: cint; + buf: {const} PByteArray; buf_size: cint): cint; + cdecl; external av__codec; {deprecated;} +{$IFEND} +{$IFEND} + +{$IF LIBAVCODEC_VERSION >= 52025000} // 52.25.0 +(** + * Decodes the audio frame of size avpkt->size from avpkt->data into samples. + * Some decoders may support multiple frames in a single AVPacket, such + * decoders would then just decode the first frame. + * If no frame + * could be decompressed, frame_size_ptr is zero. Otherwise, it is the + * decompressed frame size in bytes. * - * @warning You \e must set \p frame_size_ptr to the allocated size of the - * output buffer before calling avcodec_decode_audio2(). + * @warning You must set frame_size_ptr to the allocated size of the + * output buffer before calling avcodec_decode_audio3(). * - * @warning The input buffer must be \c FF_INPUT_BUFFER_PADDING_SIZE larger than + * @warning The input buffer must be FF_INPUT_BUFFER_PADDING_SIZE larger than * the actual read bytes because some optimized bitstream readers read 32 or 64 * bits at once and could read over the end. * - * @warning The end of the input buffer \p buf should be set to 0 to ensure that + * @warning The end of the input buffer avpkt->data should be set to 0 to ensure that * no overreading happens for damaged MPEG streams. * - * @note You might have to align the input buffer \p buf and output buffer \p + * @note You might have to align the input buffer avpkt->data and output buffer * samples. The alignment requirements depend on the CPU: On some CPUs it isn't * necessary at all, on others it won't work at all if not aligned and on others - * it will work but it will have an impact on performance. In practice, the - * bitstream should have 4 byte alignment at minimum and all sample data should - * be 16 byte aligned unless the CPU doesn't need it (AltiVec and SSE do). If - * the linesize is not a multiple of 16 then there's no sense in aligning the - * start of the buffer to 16. + * * it will work but it will have an impact on performance. + * + * In practice, avpkt->data should have 4 byte alignment at minimum and + * samples should be 16 byte aligned unless the CPU doesn't need it + * (AltiVec and SSE do). * * @note Some codecs have a delay between input and output, these need to be - * feeded with buf=NULL, buf_size=0 at the end to return the remaining frames. + * feeded with avpkt->data=NULL, avpkt->size=0 at the end to return the remaining frames. * * @param avctx the codec context * @param[out] samples the output buffer * @param[in,out] frame_size_ptr the output buffer size in bytes - * @param[in] buf the input buffer - * @param[in] buf_size the input buffer size in bytes + * @param[in] avpkt The input AVPacket containing the input buffer. + * You can create such packet with av_init_packet() and by then setting + * data and size, some decoders might in addition need other fields. + * All decoders are designed to use the least fields possible though. * @return On error a negative value is returned, otherwise the number of bytes * used or zero if no frame could be decompressed. *) -function avcodec_decode_audio2(avctx: PAVCodecContext; samples: PSmallint; +function avcodec_decode_audio3(avctx: PAVCodecContext; samples: PSmallint; var frame_size_ptr: cint; - buf: {const} PByteArray; buf_size: cint): cint; + avpkt: PAVPacket): cint; cdecl; external av__codec; {$IFEND} +{$IF LIBAVCODEC_MAX_VERSION_MAJOR < 53} +(** + * Decodes a video frame from buf into picture. + * Wrapper function which calls avcodec_decode_video2. + * + * @deprecated Use avcodec_decode_video2 instead. + * @param avctx the codec context + * @param[out] picture The AVFrame in which the decoded video frame will be stored. + * @param[in] buf the input buffer + * @param[in] buf_size the size of the input buffer in bytes + * @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherwise, it is nonzero. + * @return On error a negative value is returned, otherwise the number of bytes + * used or zero if no frame could be decompressed. + *) +function avcodec_decode_video(avctx: PAVCodecContext; picture: PAVFrame; + var got_picture_ptr: cint; + buf: {const} PByteArray; buf_size: cint): cint; + cdecl; external av__codec; {deprecated;} +{$IFEND} + +{$IF LIBAVCODEC_VERSION >= 52025000} // 52.25.0 (** - * Decodes a video frame from \p buf into \p picture. - * The avcodec_decode_video() function decodes a video frame from the input - * buffer \p buf of size \p buf_size. To decode it, it makes use of the - * video codec which was coupled with \p avctx using avcodec_open(). The - * resulting decoded frame is stored in \p picture. + * Decodes the video frame of size avpkt->size from avpkt->data into picture. + * Some decoders may support multiple frames in a single AVPacket, such + * decoders would then just decode the first frame. * - * @warning The input buffer must be \c FF_INPUT_BUFFER_PADDING_SIZE larger than + * @warning The input buffer must be FF_INPUT_BUFFER_PADDING_SIZE larger than * the actual read bytes because some optimized bitstream readers read 32 or 64 * bits at once and could read over the end. * - * @warning The end of the input buffer \p buf should be set to 0 to ensure that + * @warning The end of the input buffer buf should be set to 0 to ensure that * no overreading happens for damaged MPEG streams. * - * @note You might have to align the input buffer \p buf and output buffer \p - * samples. The alignment requirements depend on the CPU: on some CPUs it isn't + * @note You might have to align the input buffer avpkt->data. + * The alignment requirements depend on the CPU: on some CPUs it isn't * necessary at all, on others it won't work at all if not aligned and on others - * it will work but it will have an impact on performance. In practice, the - * bitstream should have 4 byte alignment at minimum and all sample data should - * be 16 byte aligned unless the CPU doesn't need it (AltiVec and SSE do). If - * the linesize is not a multiple of 16 then there's no sense in aligning the - * start of the buffer to 16. + * it will work but it will have an impact on performance. + * + * In practice, avpkt->data should have 4 byte alignment at minimum. * * @param avctx the codec context * @param[out] picture The AVFrame in which the decoded video frame will be stored. - * @param[in] buf the input buffer - * @param[in] buf_size the size of the input buffer in bytes + * @param[in] avpkt The input AVpacket containing the input buffer. + * You can create such packet with av_init_packet() and by then setting + * data and size, some decoders might in addition need other fields like + * flags&PKT_FLAG_KEY. All decoders are designed to use the least + * fields possible. * @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherwise, it is nonzero. * @return On error a negative value is returned, otherwise the number of bytes * used or zero if no frame could be decompressed. *) -function avcodec_decode_video(avctx: PAVCodecContext; picture: PAVFrame; +function avcodec_decode_video2(avctx: PAVCodecContext; picture: PAVFrame; var got_picture_ptr: cint; - buf: {const} PByteArray; buf_size: cint): cint; + avpkt: PAVPacket): cint; cdecl; external av__codec; +{$IFEND} +{$IF LIBAVCODEC_MAX_VERSION_MAJOR < 53} (* Decode a subtitle message. Return -1 if error, otherwise return the * number of bytes used. If no subtitle could be decompressed, - * got_sub_ptr is zero. Otherwise, the subtitle is stored in *sub. *) + * got_sub_ptr is zero. Otherwise, the subtitle is stored in*sub. + *) function avcodec_decode_subtitle(avctx: PAVCodecContext; sub: PAVSubtitle; var got_sub_ptr: cint; buf: {const} PByteArray; buf_size: cint): cint; cdecl; external av__codec; +{$IFEND} + +{$IF LIBAVCODEC_VERSION >= 52025000} // 52.25.0 +(* Decodes a subtitle message. + * Returns a negative value on error, otherwise returns the number of bytes used. + * If no subtitle could be decompressed, got_sub_ptr is zero. + * Otherwise, the subtitle is stored in sub. + * + * @param avctx the codec context + * @param[out] sub The AVSubtitle in which the decoded subtitle will be stored. + * @param[in,out] got_sub_ptr Zero if no subtitle could be decompressed, otherwise, it is nonzero. + * @param[in] avpkt The input AVPacket containing the input buffer. + *) +function avcodec_decode_subtitle2(avctx: PAVCodecContext; sub: PAVSubtitle; + var got_sub_ptr: cint; + avpkt: PAVPacket): cint; + cdecl; external av__codec; +{$IFEND} + function avcodec_parse_frame(avctx: PAVCodecContext; pdata: PPointer; data_size_ptr: PCint; buf: PByteArray; buf_size: cint): cint; cdecl; external av__codec; (** - * Encodes an audio frame from \p samples into \p buf. - * The avcodec_encode_audio() function encodes an audio frame from the input - * buffer \p samples. To encode it, it makes use of the audio codec which was - * coupled with \p avctx using avcodec_open(). The resulting encoded frame is - * stored in output buffer \p buf. + * Encodes an audio frame from samples into buf. * - * @note The output buffer should be at least \c FF_MIN_BUFFER_SIZE bytes large. + * @note The output buffer should be at least FF_MIN_BUFFER_SIZE bytes large. + * However, for PCM audio the user will know how much space is needed + * because it depends on the value passed in buf_size as described + * below. In that case a lower value can be used. * * @param avctx the codec context * @param[out] buf the output buffer * @param[in] buf_size the output buffer size * @param[in] samples the input buffer containing the samples * The number of samples read from this buffer is frame_size*channels, - * both of which are defined in \p avctx. - * For PCM audio the number of samples read from \p samples is equal to - * \p buf_size * input_sample_size / output_sample_size. + * both of which are defined in avctx. + * For PCM audio the number of samples read from samples is equal to + * buf_size * input_sample_size / output_sample_size. * @return On error a negative value is returned, on success zero or the number * of bytes used to encode the data read from the input buffer. *) @@ -3177,12 +3770,9 @@ function avcodec_encode_audio(avctx: PAVCodecContext; buf: PByte; cdecl; external av__codec; (** - * Encodes a video frame from \p pict into \p buf. - * The avcodec_encode_video() function encodes a video frame from the input - * \p pict. To encode it, it makes use of the video codec which was coupled with - * \p avctx using avcodec_open(). The resulting encoded bytes representing the - * frame are stored in the output buffer \p buf. The input picture should be - * stored using a specific format, namely \c avctx.pix_fmt. + * Encodes a video frame from pict into buf. + * The input picture should be + * stored using a specific format, namely avctx.pix_fmt. * * @param avctx the codec context * @param[out] buf the output buffer for the bitstream of encoded frame @@ -3208,6 +3798,7 @@ function avcodec_close(avctx: PAVCodecContext): cint; * functions. * * @see register_avcodec + * @see avcodec_register * @see av_register_codec_parser * @see av_register_bitstream_filter *) @@ -3226,7 +3817,7 @@ procedure avcodec_default_free_buffers(s: PAVCodecContext); (* misc useful functions *) (** - * Returns a single letter to describe the given picture type \p pict_type. + * Returns a single letter to describe the given picture type pict_type. * * @param[in] pict_type the picture type * @return A single character representing the picture type. @@ -3271,6 +3862,15 @@ type next_frame_offset: cint64; (* offset of the next frame *) (* video info *) pict_type: cint; (* XXX: put it back in AVCodecContext *) + (** + * This field is used for proper frame duration computation in lavf. + * It signals, how much longer the frame duration of the current frame + * is compared to normal frame duration. + * + * frame_duration = (1 + repeat_pict) * time_base + * + * It is used by codecs like H.264 to display telecined material. + *) repeat_pict: cint; (* XXX: put it back in AVCodecContext *) pts: cint64; (* pts of the current frame *) dts: cint64; (* dts of the current frame *) @@ -3293,6 +3893,94 @@ type {$IF LIBAVCODEC_VERSION >= 51057001} // 51.57.1 cur_frame_end: array [0..AV_PARSER_PTS_NB - 1] of cint64; {$IFEND} + {$IF LIBAVCODEC_VERSION >= 52016000} // 52.16.0 + (*! + * Set by parser to 1 for key frames and 0 for non-key frames. + * It is initialized to -1, so if the parser doesn't set this flag, + * old-style fallback using FF_I_TYPE picture type as key frames + * will be used. + *) + key_frame: cint; + {$IFEND} + {$IF LIBAVCODEC_VERSION >= 52018000} // 52.18.0 + (** + * Time difference in stream time base units from the pts of this + * packet to the point at which the output from the decoder has converged + * independent from the availability of previous frames. That is, the + * frames are virtually identical no matter if decoding started from + * the very first frame or from this keyframe. + * Is AV_NOPTS_VALUE if unknown. + * This field is not the display duration of the current frame. + * + * The purpose of this field is to allow seeking in streams that have no + * keyframes in the conventional sense. It corresponds to the + * recovery point SEI in H.264 and match_time_delta in NUT. It is also + * essential for some types of subtitle streams to ensure that all + * subtitles are correctly displayed after seeking. + *) + convergence_duration: cint64; + {$IFEND} + {$IF LIBAVCODEC_VERSION >= 52019000} // 52.19.0 + // Timestamp generation support: + (** + * Synchronization point for start of timestamp generation. + * + * Set to >0 for sync point, 0 for no sync point and <0 for undefined + * (default). + * + * For example, this corresponds to presence of H.264 buffering period + * SEI message. + *) + dts_sync_point: cint; + + (** + * Offset of the current timestamp against last timestamp sync point in + * units of AVCodecContext.time_base. + * + * Set to INT_MIN when dts_sync_point unused. Otherwise, it must + * contain a valid timestamp offset. + * + * Note that the timestamp of sync point has usually a nonzero + * dts_ref_dts_delta, which refers to the previous sync point. Offset of + * the next frame after timestamp sync point will be usually 1. + * + * For example, this corresponds to H.264 cpb_removal_delay. + *) + dts_ref_dts_delta: cint; + + (** + * Presentation delay of current frame in units of AVCodecContext.time_base. + * + * Set to INT_MIN when dts_sync_point unused. Otherwise, it must + * contain valid non-negative timestamp delta (presentation time of a frame + * must not lie in the past). + * + * This delay represents the difference between decoding and presentation + * time of the frame. + * + * For example, this corresponds to H.264 dpb_output_delay. + *) + pts_dts_delta: cint; + {$IFEND} + + {$IF LIBAVCODEC_VERSION >= 52021000} // 52.21.0 + (** + * Position of the packet in file. + * + * Analogous to cur_frame_pts/dts + *) + cur_frame_pos: array [0..AV_PARSER_PTS_NB - 1] of cint64; + + (** + * Byte position of currently parsed frame in stream. + *) + pos: cint64; + + (** + * Previous frame byte position. + *) + last_pos: cint64; + {$IFEND} end; TAVCodecParser = record @@ -3327,12 +4015,60 @@ procedure av_register_codec_parser(parser: PAVCodecParser); function av_parser_init(codec_id: cint): PAVCodecParserContext; cdecl; external av__codec; +{$IF LIBAVCODEC_MAX_VERSION_MAJOR < 53} function av_parser_parse(s: PAVCodecParserContext; avctx: PAVCodecContext; - poutbuf: PPointer; poutbuf_size: PCint; - buf: {const} PByteArray; buf_size: cint; - pts: cint64; dts: cint64): cint; - cdecl; external av__codec; + poutbuf: PPointer; + poutbuf_size: PCint; + buf: {const} PByteArray; + buf_size: cint; + pts: cint64; + dts: cint64): cint; + cdecl; external av__codec; deprecated; +{$IFEND} + +{$IF LIBAVCODEC_VERSION >= 52021000} // 52.21.0 +(** + * Parse a packet. + * + * @param s parser context. + * @param avctx codec context. + * @param poutbuf set to pointer to parsed buffer or NULL if not yet finished. + * @param poutbuf_size set to size of parsed buffer or zero if not yet finished. + * @param buf input buffer. + * @param buf_size input length, to signal EOF, this should be 0 (so that the last frame can be output). + * @param pts input presentation timestamp. + * @param dts input decoding timestamp. + * @param pos input byte position in stream. + * @return the number of bytes of the input bitstream used. + * + * Example: + * @code + * while (in_len) do + * begin + * len := av_parser_parse2(myparser, AVCodecContext, data, size, + * in_data, in_len, + * pts, dts, pos); + * in_data := in_data + len; + * in_len := in_len - len; + * + * if (size) then + * decode_frame(data, size); + * end; + * @endcode + *) +function av_parser_parse2(s: PAVCodecParserContext; + avctx: PAVCodecContext; + poutbuf: PPointer; + poutbuf_size: PCint; + buf: {const} PByteArray; + buf_size: cint; + pts: cint64; + dts: cint64; + pos: cint64): cint; + cdecl; external av__codec; +{$IFEND} + function av_parser_change(s: PAVCodecParserContext; avctx: PAVCodecContext; poutbuf: PPointer; poutbuf_size: PCint; @@ -3395,6 +4131,22 @@ function av_bitstream_filter_next(f: PAVBitStreamFilter): PAVBitStreamFilter; procedure av_fast_realloc(ptr: pointer; size: PCuint; min_size: cuint); cdecl; external av__codec; +{$IF LIBAVCODEC_VERSION >= 52025000} // >= 52.25.0 +(** + * Allocates a buffer, reusing the given one if large enough. + * + * Contrary to av_fast_realloc the current buffer contents might not be + * preserved and on error the old buffer is freed, thus no special + * handling to avoid memleaks is necessary. + * + * @param ptr pointer to pointer to already allocated buffer, overwritten with pointer to new buffer + * @param size size of the buffer *ptr points to + * @param min_size minimum size of *ptr buffer after returning, *ptr will be NULL and + * *size 0 if an error occurred. + *) +procedure av_fast_malloc(ptr: pointer; size: PCuint; min_size: cuint); + cdecl; external av__codec; +{$IFEND} {$IF LIBAVCODEC_VERSION < 51057000} // 51.57.0 (* for static data only *) @@ -3407,7 +4159,7 @@ procedure av_fast_realloc(ptr: pointer; size: PCuint; min_size: cuint); * and should correctly use static arrays * *) -procedure av_free_static(); +procedure av_free_static(); cdecl; external av__codec; deprecated; (** @@ -3433,22 +4185,49 @@ procedure av_realloc_static(ptr: pointer; size: cuint); (** * Copy image 'src' to 'dst'. *) -procedure av_picture_copy(dst: PAVPicture; src: {const} PAVPicture; - pix_fmt: cint; width: cint; height: cint); +procedure av_picture_copy(dst: PAVPicture; + src: {const} PAVPicture; +{$IF LIBAVCODEC_VERSION < 52022001} // 52.22.1 + pix_fmt: cint; +{$ELSE} + pix_fmt: TAVPixelFormat; +{$IFEND} + width: cint; + height: cint); cdecl; external av__codec; (** * Crop image top and left side. *) -function av_picture_crop(dst: PAVPicture; src: {const} PAVPicture; - pix_fmt: cint; top_band: cint; left_band: cint): cint; +function av_picture_crop(dst: PAVPicture; + src: {const} PAVPicture; +{$IF LIBAVCODEC_VERSION < 52022001} // 52.22.1 + pix_fmt: cint; +{$ELSE} + pix_fmt: TAVPixelFormat; +{$IFEND} + top_band: cint; + left_band: cint): cint; cdecl; external av__codec; (** * Pad image. *) -function av_picture_pad(dst: PAVPicture; src: {const} PAVPicture; height: cint; width: cint; pix_fmt: cint; - padtop: cint; padbottom: cint; padleft: cint; padright: cint; color: PCint): cint; +function av_picture_pad(dst: PAVPicture; + src: {const} PAVPicture; + height: cint; + width: cint; +{$IF LIBAVCODEC_VERSION < 52022001} // 52.22.1 + pix_fmt: cint; +{$ELSE} + pix_fmt: TAVPixelFormat; +{$IFEND} + padtop: cint; + padbottom: cint; + padleft: cint; + padright: + cint; + color: PCint): cint; cdecl; external av__codec; {$IFEND} @@ -3481,7 +4260,7 @@ function av_xiphlacing(s: PByte; v: cuint): cuint; {$IF LIBAVCODEC_VERSION >= 51041000} // 51.41.0 (** - * Parses \p str and put in \p width_ptr and \p height_ptr the detected values. + * Parses str and put in width_ptr and height_ptr the detected values. * * @return 0 in case of a successful parsing, a negative value otherwise * @param[in] str the string to parse: it has to be a string in the format @@ -3495,11 +4274,11 @@ function av_parse_video_frame_size(width_ptr: PCint; height_ptr: PCint; str: {co cdecl; external av__codec; (** - * Parses \p str and put in \p frame_rate the detected values. + * Parses str and put in frame_rate the detected values. * * @return 0 in case of a successful parsing, a negative value otherwise * @param[in] str the string to parse: it has to be a string in the format - * /, a float number or a valid video rate abbreviation + * /, a float number or a valid video rate abbreviation * @param[in,out] frame_rate pointer to the AVRational which will contain the detected * frame rate *) @@ -3518,11 +4297,13 @@ const EDOM = ESysEDOM; ENOSYS = ESysENOSYS; EILSEQ = ESysEILSEQ; + EPIPE = ESysEPIPE; {$ELSE} ENOENT = 2; EIO = 5; ENOMEM = 12; EINVAL = 22; + EPIPE = 32; // just an assumption. needs to be checked. EDOM = 33; {$IFDEF MSWINDOWS} // Note: we assume that ffmpeg was compiled with MinGW. @@ -3559,11 +4340,76 @@ const AVERROR_NOMEM = AVERROR_SIGN * ENOMEM; (**< not enough memory *) AVERROR_NOFMT = AVERROR_SIGN * EILSEQ; (**< unknown format *) AVERROR_NOTSUPP = AVERROR_SIGN * ENOSYS; (**< Operation not supported. *) - AVERROR_NOENT = AVERROR_SIGN * ENOENT; {**< No such file or directory. *} + AVERROR_NOENT = AVERROR_SIGN * ENOENT; (**< No such file or directory. *) +{$IF LIBAVCODEC_VERSION >= 52017000} // 52.17.0 + AVERROR_EOF = AVERROR_SIGN * EPIPE; (**< End of file. *) +{$IFEND} // Note: function calls as constant-initializers are invalid //AVERROR_PATCHWELCOME = -MKTAG('P','A','W','E'); {**< Not yet implemented in FFmpeg. Patches welcome. *} AVERROR_PATCHWELCOME = -(ord('P') or (ord('A') shl 8) or (ord('W') shl 16) or (ord('E') shl 24)); +{$IF LIBAVCODEC_VERSION >= 52018000} // 52.18.0 +(** + * Registers the hardware accelerator hwaccel. + *) +procedure av_register_hwaccel (hwaccel: PAVHWAccel) + cdecl; external av__codec; + +(** + * If hwaccel is NULL, returns the first registered hardware accelerator, + * if hwaccel is non-NULL, returns the next registered hardware accelerator + * after hwaccel, or NULL if hwaccel is the last one. + *) +function av_hwaccel_next (hwaccel: PAVHWAccel): PAVHWAccel; + cdecl; external av__codec; +{$IFEND} + +{$IF LIBAVCODEC_VERSION >= 52030000} // 52.30.0 +(** + * Lock operation used by lockmgr + *) +type + TAVLockOp = ( + AV_LOCK_CREATE, ///< Create a mutex + AV_LOCK_OBTAIN, ///< Lock the mutex + AV_LOCK_RELEASE, ///< Unlock the mutex + AV_LOCK_DESTROY ///< Free mutex resources + ); + +(** + * Register a user provided lock manager supporting the operations + * specified by AVLockOp. mutex points to a (void) where the + * lockmgr should store/get a pointer to a user allocated mutex. It's + * NULL upon AV_LOCK_CREATE and != NULL for all other ops. + * + * @param cb User defined callback. Note: FFmpeg may invoke calls to this + * callback during the call to av_lockmgr_register(). + * Thus, the application must be prepared to handle that. + * If cb is set to NULL the lockmgr will be unregistered. + * Also note that during unregistration the previously registered + * lockmgr callback may also be invoked. + *) +// ToDo: Implement and test this +//function av_lockmgr_register(cb: function (mutex: pointer; op: TAVLockOp)): cint; +// cdecl; external av__codec; +{$IFEND} + implementation +{$IF (LIBAVCODEC_VERSION >= 52025000) and (LIBAVCODEC_VERSION <= 5202700)} // 52.25.0 +procedure av_free_packet(pkt: PAVPacket);{$IFDEF HASINLINE} inline; {$ENDIF} +begin + if (pkt <> nil) then + begin + if (pkt.destruct <> nil) then + pkt.destruct(pkt) + else + begin + pkt.data = NULL; + pkt.size = 0; + end; + end; +end; +{$IFEND} + end. diff --git a/cmake/src/lib/ffmpeg/avformat.pas b/cmake/src/lib/ffmpeg/avformat.pas index 62df8a83..0ec2c118 100644 --- a/cmake/src/lib/ffmpeg/avformat.pas +++ b/cmake/src/lib/ffmpeg/avformat.pas @@ -29,6 +29,11 @@ * Min. version: 50.5.0 , revision 6577, Sat Oct 7 15:30:46 2006 UTC * Max. version: 52.25.0, revision 16986, Wed Feb 4 05:56:39 2009 UTC *) +{ + * update to + * Max. version: 52.34.0, Sat Jun 13 00:37:00 2009 UTC + * MiSchi +} unit avformat; @@ -60,7 +65,7 @@ uses const (* Max. supported version by this header *) LIBAVFORMAT_MAX_VERSION_MAJOR = 52; - LIBAVFORMAT_MAX_VERSION_MINOR = 25; + LIBAVFORMAT_MAX_VERSION_MINOR = 34; LIBAVFORMAT_MAX_VERSION_RELEASE = 0; LIBAVFORMAT_MAX_VERSION = (LIBAVFORMAT_MAX_VERSION_MAJOR * VERSION_MAJOR) + (LIBAVFORMAT_MAX_VERSION_MINOR * VERSION_MINOR) + @@ -92,13 +97,11 @@ function avformat_version(): cuint; cdecl; external av__format; {$IFEND} - type PAVFile = Pointer; (* * Public Metadata API. - * !!WARNING!! This is a work in progress. Don't use outside FFmpeg for now. * The metadata API allows libavformat to export metadata tags to a client * application using a sequence of key/value pairs. * Important concepts to keep in mind: @@ -111,7 +114,7 @@ type * want to store, e.g., the email address of the child of producer Alice * and actor Bob, that could have key=alice_and_bobs_childs_email_address. * 3. A tag whose value is localized for a particular language is appended - * with a dash character ('-') and the ISO 639 3-letter language code. + * with a dash character ('-') and the ISO 639-2/B 3-letter language code. * For example: Author-ger=Michael, Author-eng=Mike * The original/default language is in the unqualified "Author" tag. * A demuxer should set a default if it sets any translated tag. @@ -130,53 +133,51 @@ type PAVMetadata = Pointer; {$IF LIBAVFORMAT_VERSION > 52024001} // > 52.24.1 - (** - * gets a metadata element with matching key. - * @param prev set to the previous matching element to find the next. - * @param flags allows case as well as suffix insensitive comparisons. - * @return found tag or NULL, changing key or value leads to undefined behavior. + * Gets a metadata element with matching key. + * @param prev Set to the previous matching element to find the next. + * @param flags Allows case as well as suffix-insensitive comparisons. + * @return Found tag or NULL, changing key or value leads to undefined behavior. *) function av_metadata_get(m: PAVMetadata; key: {const} PAnsiChar; prev: {const} PAVMetadataTag ; flags: cint): PAVMetadataTag; cdecl; external av__format; (** - * sets the given tag in m, overwriting an existing tag. - * @param key tag key to add to m (will be av_strduped). - * @param value tag value to add to m (will be av_strduped). - * @return >= 0 if success otherwise error code that is <0. + * Sets the given tag in m, overwriting an existing tag. + * @param key tag key to add to m (will be av_strduped) + * @param value tag value to add to m (will be av_strduped) + * @return >= 0 on success otherwise an error code <0 *) function av_metadata_set(var pm: PAVMetadata; key: {const} PAnsiChar; value: {const} PAnsiChar): cint; cdecl; external av__format; (** - * Free all the memory allocated for an AVMetadata struct. + * Frees all the memory allocated for an AVMetadata struct. *) procedure av_metadata_free(var m: PAVMetadata); cdecl; external av__format; - {$IFEND} (* packet functions *) +{$IF LIBAVCODEC_VERSION < 52032000} // < 52.32.0 type PAVPacket = ^TAVPacket; TAVPacket = record (** - * Presentation time stamp in time_base units. - * This is the time at which the decompressed packet will be presented - * to the user. + * Presentation timestamp in time_base units; the time at which the + * decompressed packet will be presented to the user. * Can be AV_NOPTS_VALUE if it is not stored in the file. * pts MUST be larger or equal to dts as presentation can not happen before * decompression, unless one wants to view hex dumps. Some formats misuse - * the terms dts and pts/cts to mean something different, these timestamps + * the terms dts and pts/cts to mean something different. Such timestamps * must be converted to true pts/dts before they are stored in AVPacket. *) pts: cint64; (** - * Decompression time stamp in time_base units. - * This is the time at which the packet is decompressed. + * Decompression timestamp in time_base units; the time at which the + * packet is decompressed. * Can be AV_NOPTS_VALUE if it is not stored in the file. *) dts: cint64; @@ -245,6 +246,7 @@ procedure av_init_packet(var pkt: TAVPacket); *) function av_new_packet(var pkt: TAVPacket; size: cint): cint; cdecl; external av__format; +{$IFEND} (** * Allocate and read the payload of a packet and initialize its fields with @@ -257,6 +259,7 @@ function av_new_packet(var pkt: TAVPacket; size: cint): cint; function av_get_packet(s: PByteIOContext; var pkt: TAVPacket; size: cint): cint; cdecl; external av__format; +{$IF LIBAVCODEC_VERSION < 52032000} // < 52.32.0 (** * @warning This is a hack - the packet memory allocation stuff is broken. The * packet is allocated if it was not really allocated. @@ -270,6 +273,7 @@ function av_dup_packet(pkt: PAVPacket): cint; * @param pkt packet to free *) procedure av_free_packet(pkt: PAVPacket); {$IFDEF HasInline}inline;{$ENDIF} +{$IFEND} (*************************************************) (* fractional numbers for exact pts handling *) @@ -278,7 +282,6 @@ type (** * The exact value of the fractional number is: 'val + num / den'. * num is assumed to be 0 <= num < den. - * @deprecated Use AVRational instead. *) PAVFrac = ^TAVFrac; TAVFrac = record @@ -297,7 +300,7 @@ type end; const - AVPROBE_SCORE_MAX = 100; ///< Maximum score, half of that is used for file-extension-based detection. + AVPROBE_SCORE_MAX = 100; ///< Maximum score, half of that is used for file-extension-based detection AVPROBE_PADDING_SIZE = 32; ///< extra allocated bytes at the end of the probe buffer //! Demuxer will use url_fopen, no opened file should be provided by the caller. @@ -310,6 +313,9 @@ const AVFMT_NOTIMESTAMPS = $0080; (**< Format does not need / have any timestamps. *) AVFMT_GENERIC_INDEX = $0100; (**< Use generic index building code. *) AVFMT_TS_DISCONT = $0200; (**< Format allows timestamp discontinuities. *) + {$IF LIBAVFORMAT_VERSION >= 52029002} // 52.29.2 + AVFMT_VARIABLE_FPS = $0400; (**< Format allows variable fps. *) + {$IFEND} // used by AVIndexEntry AVINDEX_KEYFRAME = $0001; @@ -320,7 +326,7 @@ const AVFMT_NOOUTPUTLOOP = -1; AVFMT_INFINITEOUTPUTLOOP = 0; - AVFMT_FLAG_GENPTS = $0001; ///< Generate pts if missing even if it requires parsing future frames. + AVFMT_FLAG_GENPTS = $0001; ///< Generate missing pts even if it requires parsing future frames. AVFMT_FLAG_IGNIDX = $0002; ///< Ignore index. AVFMT_FLAG_NONBLOCK = $0004; ///< Do not block when reading packets from input. @@ -339,7 +345,11 @@ const AV_DISPOSITION_KARAOKE = $0020; // used by TAVFormatContext.debug - FF_FDEBUG_TS = 0001; + FF_FDEBUG_TS = 0001; + + {$IF LIBAVFORMAT_VERSION >= 52034000} // > 52.34.0 + MAX_PROBE_PACKETS = 100; + {$IFEND} type PPAVCodecTag = ^PAVCodecTag; @@ -367,12 +377,29 @@ type PAVImageInfo = ^TAVImageInfo; {$IFEND} +{$IF LIBAVFORMAT_VERSION >= 52030001} // >= 52.30.1 +(** + * Convert all the metadata sets from ctx according to the source and + * destination conversion tables. + * @param d_conv destination tags format conversion table + * @param s_conv source tags format conversion table + *) + PAVMetadataConv = ^TAVMetadataConv; + TAVMetadataConv = record + ctx: PAVFormatContext; + d_conv: {const} PAVMetadataConv; + s_conv: {const} PAVMetadataConv; + end; +{$IFEND} + PAVChapter = ^TAVChapter; TAVChapter = record id: cint; ///< unique ID to identify the chapter time_base: TAVRational; ///< time base in which the start/end timestamps are specified start, end_: cint64; ///< chapter start/end time in time_base units + {$IF LIBAVFORMAT_VERSION < 53000000} // 53.00.0 title: PAnsiChar; ///< chapter title + {$IFEND} {$IF LIBAVFORMAT_VERSION >= 52024001} // 52.24.1 metadata: PAVMetadata; {$IFEND} @@ -415,13 +442,13 @@ type name: PAnsiChar; (** * Descriptive name for the format, meant to be more human-readable - * than \p name. You \e should use the NULL_IF_CONFIG_SMALL() macro + * than name. You should use the NULL_IF_CONFIG_SMALL() macro * to define it. *) long_name: PAnsiChar; mime_type: PAnsiChar; extensions: PAnsiChar; (**< comma-separated filename extensions *) - (** Size of private data so that it can be allocated in the wrapper. *) + (** size of private data so that it can be allocated in the wrapper *) priv_data_size: cint; (* output support *) audio_codec: TCodecID; (**< default audio codec *) @@ -439,7 +466,7 @@ type {$IF LIBAVFORMAT_VERSION >= 51008000} // 51.8.0 (** * List of supported codec_id-codec_tag pairs, ordered by "better - * choice first". The arrays are all CODEC_ID_NONE terminated. + * choice first". The arrays are all terminated by CODEC_ID_NONE. *) codec_tag: {const} PPAVCodecTag; {$IFEND} @@ -448,6 +475,10 @@ type subtitle_codec: TCodecID; (**< default subtitle codec *) {$IFEND} + {$IF LIBAVFORMAT_VERSION >= 52030001} // 52.30.1 + {const} metadata_conv: PAVMetadataConv; + {$IFEND} + (* private fields *) next: PAVOutputFormat; end; @@ -456,14 +487,14 @@ type name: PAnsiChar; (** * Descriptive name for the format, meant to be more human-readable - * than \p name. You \e should use the NULL_IF_CONFIG_SMALL() macro + * than name. You should use the NULL_IF_CONFIG_SMALL() macro * to define it. *) long_name: PAnsiChar; (** Size of private data so that it can be allocated in the wrapper. *) priv_data_size: cint; (** - * Tell if a given file has a chance of being parsed by this format. + * Tell if a given file has a chance of being parsed as this format. * The buffer provided is guaranteed to be AVPROBE_PADDING_SIZE bytes * big so you do not have to check for that unless you need more. *) @@ -475,21 +506,28 @@ type read_header: function (c: PAVFormatContext; ap: PAVFormatParameters): cint; cdecl; (** Read one packet and put it in 'pkt'. pts and flags are also set. 'av_new_stream' can be called only if the flag - AVFMTCTX_NOHEADER is used. *) + AVFMTCTX_NOHEADER is used. + @return 0 on success, < 0 on error. + When returning an error, pkt must not have been allocated + or must be freed before returning *) read_packet: function (c: PAVFormatContext; var pkt: TAVPacket): cint; cdecl; (** Close the stream. The AVFormatContext and AVStreams are not freed by this function *) read_close: function (c: PAVFormatContext): cint; cdecl; + +{$IF LIBAVFORMAT_VERSION_MAJOR < 53} (** * Seek to a given timestamp relative to the frames in * stream component stream_index. - * @param stream_index must not be -1 - * @param flags selects which direction should be preferred if no exact - * match is available + * @param stream_index Must not be -1. + * @param flags Selects which direction should be preferred if no exact + * match is available. * @return >= 0 on success (but not necessarily the new offset) *) read_seek: function (c: PAVFormatContext; stream_index: cint; timestamp: cint64; flags: cint): cint; cdecl; +{$IFEND} + (** * Gets the next timestamp in stream[stream_index].time_base units. * @return the timestamp or AV_NOPTS_VALUE if an error occurred @@ -517,6 +555,25 @@ type codec_tag: {const} PPAVCodecTag; {$IFEND} + {$IF LIBAVFORMAT_VERSION >= 52030000} // 52.30.0 + (** + * Seek to timestamp ts. + * Seeking will be done so that the point from which all active streams + * can be presented successfully will be closest to ts and within min/max_ts. + * Active streams are all streams that have AVStream.discard < AVDISCARD_ALL. + *) + read_seek2: function (s: PAVFormatContext; + stream_index: cint; + min_ts: cint64; + ts: cint64; + max_ts: cint64; + flags: cint): cint; cdecl; + {$IFEND} + + {$IF LIBAVFORMAT_VERSION >= 52030001} // 52.30.1 + {const} metadata_conv: PAVMetadataConv; + {$IFEND} + (* private fields *) next: PAVInputFormat; end; @@ -551,11 +608,11 @@ type id: cint; (**< format-specific stream ID *) codec: PAVCodecContext; (**< codec context *) (** - * Real base frame rate of the stream. - * This is the lowest frame rate with which all timestamps can be + * Real base framerate of the stream. + * This is the lowest framerate with which all timestamps can be * represented accurately (it is the least common multiple of all - * frame rates in the stream). Note, this value is just a guess! - * For example if the timebase is 1/90000 and all frames have either + * framerates in the stream). Note, this value is just a guess! + * For example, if the time base is 1/90000 and all frames have either * approximately 3600 or 1800 timer ticks, then r_frame_rate will be 50/1. *) r_frame_rate: TAVRational; @@ -572,7 +629,7 @@ type (** * This is the fundamental unit of time (in seconds) in terms * of which frame timestamps are represented. For fixed-fps content, - * time base should be 1/frame rate and timestamp increments should be 1. + * time base should be 1/framerate and timestamp increments should be 1. *) time_base: TAVRational; pts_wrap_bits: cint; (* number of bits in pts (used for wrapping control) *) @@ -599,7 +656,9 @@ type *) duration: cint64; - language: array [0..3] of PAnsiChar; (* ISO 639 3-letter language code (empty string if undefined) *) + {$IF LIBAVFORMAT_VERSION_MAJOR < 53} + language: array [0..3] of PAnsiChar; (* ISO 639-2/B 3-letter language code (empty string if undefined) *) + {$IFEND} (* av_read_frame() support *) need_parsing: TAVStreamParseType; @@ -620,7 +679,7 @@ type unused: array [0..4] of cint64; {$IFEND} - {$IF LIBAVFORMAT_VERSION >= 52006000} // 52.6.0 + {$IF (LIBAVFORMAT_VERSION >= 52006000) and (LIBAVFORMAT_VERSION_MAJOR < 53)} // 52.6.0 - 53.0.0 filename: PAnsiChar; (**< source filename of the stream *) {$IFEND} @@ -653,6 +712,25 @@ type cur_len: cint; cur_pkt: TAVPacket; {$IFEND} + + {$IF LIBAVFORMAT_VERSION >= 52030000} // > 52.30.0 + // Timestamp generation support: + (** + * Timestamp corresponding to the last dts sync point. + * + * Initialized when AVCodecParserContext.dts_sync_point >= 0 and + * a DTS is received from the underlying container. Otherwise set to + * AV_NOPTS_VALUE by default. + *) + reference_dts: cint64; + {$IFEND} + {$IF LIBAVFORMAT_VERSION >= 52034000} // > 52.34.0 + (** + * Number of packets to buffer for codec probing + * NOT PART OF PUBLIC API + *) + probe_packets: cint; + {$IFEND} end; (** @@ -663,7 +741,7 @@ type * sizeof(AVFormatContext) must not be used outside libav*. *) TAVFormatContext = record - av_class: PAVClass; (**< Set by av_alloc_format_context. *) + av_class: PAVClass; (**< Set by avformat_alloc_context. *) (* Can only be iformat or oformat, not both at the same time. *) iformat: PAVInputFormat; oformat: PAVOutputFormat; @@ -680,6 +758,7 @@ type filename: array [0..1023] of AnsiChar; (* input or output filename *) (* stream info *) timestamp: cint64; + {$IF LIBAVFORMAT_VERSION < 53000000} // 53.00.0 title: array [0..511] of AnsiChar; author: array [0..511] of AnsiChar; copyright: array [0..511] of AnsiChar; @@ -688,6 +767,7 @@ type year: cint; (**< ID3 year, 0 if none *) track: cint; (**< track number, 0 if none *) genre: array [0..31] of AnsiChar; (**< ID3 genre *) + {$IFEND} ctx_flags: cint; (**< Format-specific flags, see AVFMTCTX_xx *) (* private data for pts handling (do not modify directly). *) @@ -735,7 +815,7 @@ type loop_input: cint; {$IF LIBAVFORMAT_VERSION >= 50006000} // 50.6.0 - (** Decoding: size of data to probe; encoding: unused. *) + (** decoding: size of data to probe; encoding: unused. *) probesize: cuint; {$IFEND} @@ -775,8 +855,8 @@ type {$IF LIBAVFORMAT_VERSION >= 52004000} // 52.4.0 (** - * Maximum amount of memory in bytes to use per stream for the index. - * If the needed index exceeds this size, entries will be discarded as + * Maximum amount of memory in bytes to use for the index of each stream. + * If the index exceeds this size, entries will be discarded as * needed to maintain a smaller size. This can lead to slower or less * accurate seeking (depends on demuxer). * Demuxers for which a full in-memory index is mandatory will ignore @@ -833,8 +913,10 @@ type *) TAVProgram = record id : cint; + {$IF LIBAVFORMAT_VERSION < 53000000} // 53.00.0 provider_name : PAnsiChar; ///< network name for DVB streams name : PAnsiChar; ///< service name for DVB streams + {$IFEND} flags : cint; discard : TAVDiscard; ///< selects which program to discard and which to feed to the caller {$IF LIBAVFORMAT_VERSION >= 51016000} // 51.16.0 @@ -908,8 +990,18 @@ var {$IFEND} {$IF LIBAVFORMAT_VERSION >= 52003000} // 52.3.0 +(** + * If f is NULL, returns the first registered input format, + * if f is non-NULL, returns the next registered input format after f + * or NULL if f is the last one. + *) function av_iformat_next(f: PAVInputFormat): PAVInputFormat; cdecl; external av__format; +(** + * If f is NULL, returns the first registered output format, + * if f is non-NULL, returns the next registered input format after f + * or NULL if f is the last one. + *) function av_oformat_next(f: PAVOutputFormat): PAVOutputFormat; cdecl; external av__format; {$IFEND} @@ -917,8 +1009,8 @@ function av_oformat_next(f: PAVOutputFormat): PAVOutputFormat; function av_guess_image2_codec(filename: {const} PAnsiChar): TCodecID; cdecl; external av__format; -(* XXX: use automatic init with either ELF sections or C file parser *) -(* modules *) +(* XXX: Use automatic init with either ELF sections or C file parser *) +(* modules. *) (* utils.c *) procedure av_register_input_format(format: PAVInputFormat); @@ -1006,7 +1098,7 @@ procedure av_pkt_dump_log(avcl: Pointer; level: cint; pkt: PAVPacket; dump_paylo * * @see av_register_input_format() * @see av_register_output_format() - * @see register_protocol() + * @see av_register_protocol() *) procedure av_register_all(); cdecl; external av__format; @@ -1062,18 +1154,28 @@ function av_open_input_file(var ic_ptr: PAVFormatContext; filename: PAnsiChar; ap: PAVFormatParameters): cint; cdecl; external av__format; +{$IF LIBAVFORMAT_VERSION >= 52026000} // 52.26.0 (** * Allocate an AVFormatContext. * Can be freed with av_free() but do not forget to free everything you * explicitly allocated as well! *) +function avformat_alloc_context(): PAVFormatContext; + cdecl; external av__format; +{$ELSE} + {$IF LIBAVFORMAT_VERSION_MAJOR < 53} +(** + * @deprecated Use avformat_alloc_context() instead. + *) function av_alloc_format_context(): PAVFormatContext; cdecl; external av__format; + {$IFEND} +{$IFEND} (** * Read packets of a media file to get stream information. This * is useful for file formats with no headers such as MPEG. This - * function also computes the real frame rate in case of MPEG-2 repeat + * function also computes the real framerate in case of MPEG-2 repeat * frame mode. * The logical file position is not changed by this function; * examined packets may be buffered for later processing. @@ -1111,7 +1213,7 @@ function av_read_packet(s: PAVFormatContext; var pkt: TAVPacket): cint; * then it contains one frame. * * pkt->pts, pkt->dts and pkt->duration are always set to correct - * values in AVStream.timebase units (and guessed if the format cannot + * values in AVStream.time_base units (and guessed if the format cannot * provide them). pkt->pts can be AV_NOPTS_VALUE if the video format * has B-frames, so it is better to rely on pkt->dts if you do not * decompress the payload. @@ -1122,7 +1224,7 @@ function av_read_frame(s: PAVFormatContext; var pkt: TAVPacket): cint; cdecl; external av__format; (** - * Seek to the key frame at timestamp. + * Seek to the keyframe at timestamp. * 'timestamp' in 'stream_index'. * @param stream_index If stream_index is (-1), a default * stream is selected, and timestamp is automatically converted @@ -1136,15 +1238,51 @@ function av_seek_frame(s: PAVFormatContext; stream_index: cint; timestamp: cint6 flags: cint): cint; cdecl; external av__format; +{$IF LIBAVFORMAT_VERSION >= 52026000} // 52.26.0 (** - * Start playing a network based stream (e.g. RTSP stream) at the + * Seek to timestamp ts. + * Seeking will be done so that the point from which all active streams + * can be presented successfully will be closest to ts and within min/max_ts. + * Active streams are all streams that have AVStream.discard < AVDISCARD_ALL. + * + * If flags contain AVSEEK_FLAG_BYTE, then all timestamps are in byte and + * are the file position (this may not be supported by all demuxers). + * If flags contain AVSEEK_FLAG_FRAME then all timestamps are in frames + * in the stream with stream_index (this may not be supported by all demuxers). + * Otherwise all timestamps are in units of the stream selected by stream_index + * or if stream_index is -1, in AV_TIME_BASE units. + * If flags contain AVSEEK_FLAG_ANY, then non-keyframes are treated as + * keyframes (this may not be supported by all demuxers). + * + * @param stream_index index of the stream which is used as time base reference. + * @param min_ts smallest acceptable timestamp + * @param ts target timestamp + * @param max_ts largest acceptable timestamp + * @param flags flags + * @returns >=0 on success, error code otherwise + * + * @NOTE This is part of the new seek API which is still under construction. + * Thus do not use this yet. It may change at any time, do not expect + * ABI compatibility yet! + *) +function avformat_seek_file(s: PAVFormatContext; + stream_index: cint; + min_ts: cint64; + ts: cint64; + max_ts: cint64; + flags: cint): cint; + cdecl; external av__format; +{$IFEND} + +(** + * Start playing a network-based stream (e.g. RTSP stream) at the * current position. *) function av_read_play(s: PAVFormatContext): cint; cdecl; external av__format; (** - * Pause a network based stream (e.g. RTSP stream). + * Pause a network-based stream (e.g. RTSP stream). * * Use av_read_play() to resume it. *) @@ -1239,7 +1377,7 @@ function av_index_search_timestamp(st: PAVStream; timestamp: cint64; flags: cint {$IF LIBAVFORMAT_VERSION >= 52004000} // 52.4.0 (** * Ensures the index uses less memory than the maximum specified in - * AVFormatContext.max_index_size, by discarding entries if it grows + * AVFormatContext.max_index_size by discarding entries if it grows * too large. * This function is not part of the public API and should only be called * by demuxers. @@ -1337,7 +1475,7 @@ function av_write_frame(s: PAVFormatContext; var pkt: TAVPacket): cint; * Writes a packet to an output media file ensuring correct interleaving. * * The packet must contain one audio or video frame. - * If the packets are already correctly interleaved the application should + * If the packets are already correctly interleaved, the application should * call av_write_frame() instead as it is slightly faster. It is also important * to keep in mind that completely non-interleaved input will need huge amounts * of memory to interleave with this, so it is preferable to interleave at the @@ -1355,7 +1493,7 @@ function av_interleaved_write_frame(s: PAVFormatContext; var pkt: TAVPacket): ci * Interleave a packet per dts in an output media file. * * Packets with pkt->destruct == av_destruct_packet will be freed inside this - * function, so they cannot be used after it, note calling av_free_packet() + * function, so they cannot be used after it. Note that calling av_free_packet() * on them is still safe. * * @param s media file handle @@ -1370,6 +1508,24 @@ function av_interleave_packet_per_dts(s: PAVFormatContext; _out: PAVPacket; pkt: PAVPacket; flush: cint): cint; cdecl; external av__format; +{$IF LIBAVFORMAT_VERSION >= 52025000} // 52.25.0 +(** + * Add packet to AVFormatContext->packet_buffer list, determining its + * interleaved position using compare() function argument. + * + * This function is not part of the public API and should only be called + * by muxers using their own interleave function. + *) +{ +procedure ff_interleave_add_packet(s: PAVFormatContext; + pkt: PAVPacket; + compare: function(para1: PAVFormatContext; + para2: PAVPacket; + para3: PAVPacket): cint); + cdecl; external av__format; +} +{$IFEND} + (** * @brief Write the stream trailer to an output media file and * free the file private data. @@ -1396,7 +1552,7 @@ function parse_image_size(width_ptr: PCint; height_ptr: PCint; {$IF LIBAVFORMAT_VERSION_MAJOR < 53} (** - * Converts frame rate from string to a fraction. + * Converts framerate from a string to a fraction. * @deprecated Use av_parse_video_frame_rate instead. *) function parse_frame_rate(frame_rate: PCint; frame_rate_base: PCint; @@ -1405,7 +1561,7 @@ function parse_frame_rate(frame_rate: PCint; frame_rate_base: PCint; {$IFEND} (** - * Parses \p datestr and returns a corresponding number of microseconds. + * Parses datestr and returns a corresponding number of microseconds. * @param datestr String representing a date or a duration. * - If a date the syntax is: * @code @@ -1416,7 +1572,7 @@ function parse_frame_rate(frame_rate: PCint; frame_rate_base: PCint; * If the year-month-day part is not specified it takes the current * year-month-day. * Returns the number of microseconds since 1st of January, 1970 up to - * the time of the parsed date or INT64_MIN if \p datestr cannot be + * the time of the parsed date or INT64_MIN if datestr cannot be * successfully parsed. * - If a duration the syntax is: * @code @@ -1424,10 +1580,10 @@ function parse_frame_rate(frame_rate: PCint; frame_rate_base: PCint; * [-]S+[.m...] * @endcode * Returns the number of microseconds contained in a time interval - * with the specified duration or INT64_MIN if \p datestr cannot be + * with the specified duration or INT64_MIN if datestr cannot be * successfully parsed. - * @param duration Flag which tells how to interpret \p datestr, if - * not zero \p datestr is interpreted as a duration, otherwise as a + * @param duration Flag which tells how to interpret datestr, if + * not zero datestr is interpreted as a duration, otherwise as a * date. *) function parse_date(datestr: PAnsiChar; duration: cint): cint64; @@ -1444,7 +1600,11 @@ const function ffm_read_write_index(fd: cint): cint64; cdecl; external av__format; +{$IF LIBAVFORMAT_VERSION < 52027000} // 52.27.0 procedure ffm_write_write_index(fd: cint; pos: cint64); +{$ELSE} +function ffm_write_write_index(fd: cint; pos: cint64): cint; +{$IFEND} cdecl; external av__format; procedure ffm_set_write_index(s: PAVFormatContext; pos: cint64; file_size: cint64); @@ -1460,7 +1620,7 @@ function find_info_tag(arg: PAnsiChar; arg_size: cint; tag1: PAnsiChar; info: PA cdecl; external av__format; (** - * Returns in 'buf' the path with '%d' replaced by number. + * Returns in 'buf' the path with '%d' replaced by a number. * * Also handles the '%0nd' format where 'n' is the total number * of digits and '%%'. @@ -1526,10 +1686,12 @@ begin end; {$IFEND} +{$IF LIBAVCODEC_VERSION < 52032000} // < 52.32.0 procedure av_free_packet(pkt: PAVPacket); begin if ((pkt <> nil) and (@pkt^.destruct <> nil)) then pkt^.destruct(pkt); end; +{$IFEND} end. diff --git a/cmake/src/lib/ffmpeg/avio.pas b/cmake/src/lib/ffmpeg/avio.pas index 33778206..dc0a330b 100644 --- a/cmake/src/lib/ffmpeg/avio.pas +++ b/cmake/src/lib/ffmpeg/avio.pas @@ -27,7 +27,12 @@ (* * Conversion of libavformat/avio.h - * revision 16100, Sat Dec 13 13:39:13 2008 UTC + * unbuffered I/O operations + * revision 16100, Sat Dec 13 13:39:13 2008 UTC + * update Tue, Jun 10 01:00:00 2009 UTC + * + * @warning This file has to be considered an internal but installed + * header, so it should not be directly included in your projects. *) unit avio; @@ -103,6 +108,7 @@ type name: PAnsiChar; url_open: function (h: PURLContext; filename: {const} PAnsiChar; flags: cint): cint; cdecl; url_read: function (h: PURLContext; buf: PByteArray; size: cint): cint; cdecl; + url_read_complete: function (h: PURLContext; buf: PByteArray; size: cint): cint; cdecl; url_write: function (h: PURLContext; buf: PByteArray; size: cint): cint; cdecl; url_seek: function (h: PURLContext; pos: cint64; whence: cint): cint64; cdecl; url_close: function (h: PURLContext): cint; cdecl; @@ -180,6 +186,16 @@ function url_exist(filename: {const} PAnsiChar): cint; cdecl; external av__format; function url_filesize (h: PURLContext): cint64; cdecl; external av__format; +{ + * Return the file descriptor associated with this URL. For RTP, this + * will return only the RTP file descriptor, not the RTCP file descriptor. + * To get both, use rtp_get_file_handles(). + * + * @return the file descriptor associated with this URL, or <0 on error. +} +(* not implemented *) +function url_get_file_handle(h: PURLContext): cint; + cdecl; external av__format; (** * Return the maximum packet size associated to packetized file @@ -240,19 +256,34 @@ function av_url_read_seek(h: PURLContext; stream_index: cint; cdecl; external av__format; {$IFEND} -{ +(** var +{$IF LIBAVFORMAT_VERSION_MAJOR < 53} first_protocol: PURLProtocol; external av__format; +{$IFEND} url_interrupt_cb: PURLInterruptCB; external av__format; -} +**) +{ +* If protocol is NULL, returns the first registered protocol, +* if protocol is non-NULL, returns the next registered protocol after protocol, +* or NULL if protocol is the last one. +} {$IF LIBAVFORMAT_VERSION >= 52002000} // 52.2.0 function av_protocol_next(p: PURLProtocol): PURLProtocol; cdecl; external av__format; {$IFEND} +{$IF LIBAVFORMAT_VERSION <= 52028000} // 52.28.0 +(** + * @deprecated Use av_register_protocol() instead. + *) function register_protocol (protocol: PURLProtocol): cint; cdecl; external av__format; +{$ELSE} +function av_register_protocol (protocol: PURLProtocol): cint; + cdecl; external av__format; +{$IFEND} type TReadWriteFunc = function (opaque: Pointer; buf: PByteArray; buf_size: cint): cint; cdecl; @@ -521,7 +552,7 @@ function ff_crc04C11DB7_update(checksum: culong; buf: {const} PByteArray; {$IFEND} function get_checksum(s: PByteIOContext): culong; cdecl; external av__format; -procedure init_checksum(s: PByteIOContext; +procedure init_gsum(s: PByteIOContext; update_checksum: pointer; checksum: culong); cdecl; external av__format; @@ -531,9 +562,11 @@ function udp_set_remote_url(h: PURLContext; uri: {const} PAnsiChar): cint; cdecl; external av__format; function udp_get_local_port(h: PURLContext): cint; cdecl; external av__format; +{$IF LIBAVFORMAT_VERSION_MAJOR <= 52} function udp_get_file_handle(h: PURLContext): cint; cdecl; external av__format; - +{$IFEND} + implementation function url_is_streamed(s: PByteIOContext): cint; diff --git a/cmake/src/lib/ffmpeg/avutil.pas b/cmake/src/lib/ffmpeg/avutil.pas index 6de35f1b..6a93ea12 100644 --- a/cmake/src/lib/ffmpeg/avutil.pas +++ b/cmake/src/lib/ffmpeg/avutil.pas @@ -29,14 +29,21 @@ * * libavutil/avutil.h: * Min. version: 49.0.1, revision 6577, Sat Oct 7 15:30:46 2006 UTC - * Max. version: 49.14.0, revision 16912, Sun Feb 1 02:00:19 2009 UTC + * Max. version: 49.14.0, revision 16912, Sun Feb 1 02:00:19 2009 UTC * * libavutil/mem.h: - * revision 16590, Tue Jan 13 23:44:16 2009 UTC + * revision 16590, Tue Jan 13 23:44:16 2009 UTC * * libavutil/log.h: - * revision 16571, Tue Jan 13 00:14:43 2009 UTC + * revision 16571, Tue Jan 13 00:14:43 2009 UTC *) +{ + Update changes auf avutil.h, mem.h and log.h + Max. version 50.03.0, Tue, Jun 09 24:00:00 2009 UTC + include/keep pixfmt.h (change in revision 50.01.0) + Maybe, the pixelformats are not needed, but it has not been checked. + log.h is only partial. +} unit avutil; @@ -62,8 +69,8 @@ uses const (* Max. supported version by this header *) - LIBAVUTIL_MAX_VERSION_MAJOR = 49; - LIBAVUTIL_MAX_VERSION_MINOR = 14; + LIBAVUTIL_MAX_VERSION_MAJOR = 50; + LIBAVUTIL_MAX_VERSION_MINOR = 3; LIBAVUTIL_MAX_VERSION_RELEASE = 0; LIBAVUTIL_MAX_VERSION = (LIBAVUTIL_MAX_VERSION_MAJOR * VERSION_MAJOR) + (LIBAVUTIL_MAX_VERSION_MINOR * VERSION_MINOR) + @@ -112,6 +119,14 @@ type * components stored in AVFrame.data[1] should be in the range 0..255. * This is important as many custom PAL8 video codecs that were designed * to run on the IBM VGA graphics adapter use 6-bit palette components. + * + * For all the 8bit per pixel formats, an RGB32 palette is in data[1] like + * for pal8. This palette is filled in automatically by the function + * allocating the picture. + * + * Note, make sure that all newly added big endian formats have pix_fmt&1==1 + * and that all newly added little endian formats have pix_fmt&1==0 + * this allows simpler detection of big vs little endian. *) PAVPixelFormat = ^TAVPixelFormat; @@ -123,11 +138,15 @@ type PIX_FMT_BGR24, ///< packed RGB 8:8:8, 24bpp, BGRBGR... PIX_FMT_YUV422P, ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) PIX_FMT_YUV444P, ///< planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples) +{$IF LIBAVUTIL_VERSION <= 50001000} // 50.01.0 PIX_FMT_RGB32, ///< packed RGB 8:8:8, 32bpp, (msb)8A 8R 8G 8B(lsb), in CPU endianness +{$IFEND} PIX_FMT_YUV410P, ///< planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples) PIX_FMT_YUV411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) +{$IF LIBAVUTIL_VERSION <= 50000000} // 50.00.0 PIX_FMT_RGB565, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), in CPU endianness PIX_FMT_RGB555, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), in CPU endianness, most significant bit to 0 +{$IFEND} PIX_FMT_GRAY8, ///< Y , 8bpp PIX_FMT_MONOWHITE, ///< Y , 1bpp, 0 is white, 1 is black PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black, 1 is white @@ -135,13 +154,17 @@ type PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG) PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG) PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG) - PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing(xvmc_render.h) + PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing PIX_FMT_XVMC_MPEG2_IDCT, PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1 PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3 +{$IF LIBAVUTIL_VERSION <= 50001000} // 50.01.0 PIX_FMT_BGR32, ///< packed RGB 8:8:8, 32bpp, (msb)8A 8B 8G 8R(lsb), in CPU endianness +{$IFEND} +{$IF LIBAVUTIL_VERSION <= 50000000} // 50.00.0 PIX_FMT_BGR565, ///< packed RGB 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), in CPU endianness PIX_FMT_BGR555, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), in CPU endianness, most significant bit to 1 +{$IFEND} PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb) PIX_FMT_BGR4, ///< packed RGB 1:2:1, 4bpp, (msb)1B 2G 1R(lsb) PIX_FMT_BGR4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb) @@ -150,10 +173,15 @@ type PIX_FMT_RGB4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb) PIX_FMT_NV12, ///< planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 for UV PIX_FMT_NV21, ///< as above, but U and V bytes are swapped - +{$IF LIBAVUTIL_VERSION <= 50001000} // 50.01.0 PIX_FMT_RGB32_1, ///< packed RGB 8:8:8, 32bpp, (msb)8R 8G 8B 8A(lsb), in CPU endianness PIX_FMT_BGR32_1, ///< packed RGB 8:8:8, 32bpp, (msb)8B 8G 8R 8A(lsb), in CPU endianness - +{$ELSE} // 50.02.0 + PIX_FMT_ARGB, ///< packed ARGB 8:8:8:8, 32bpp, ARGBARGB... + PIX_FMT_RGBA, ///< packed RGBA 8:8:8:8, 32bpp, RGBARGBA... + PIX_FMT_ABGR, ///< packed ABGR 8:8:8:8, 32bpp, ABGRABGR... + PIX_FMT_BGRA, ///< packed BGRA 8:8:8:8, 32bpp, BGRABGRA... +{$IFEND} PIX_FMT_GRAY16BE, ///< Y , 16bpp, big-endian PIX_FMT_GRAY16LE, ///< Y , 16bpp, little-endian PIX_FMT_YUV440P, ///< planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples) @@ -164,23 +192,74 @@ type PIX_FMT_VDPAU_MPEG2,///< MPEG-2 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers PIX_FMT_VDPAU_WMV3,///< WMV3 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers PIX_FMT_VDPAU_VC1, ///< VC-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers +{$IF LIBAVUTIL_VERSION >= 49015000} // 49.15.0 + PIX_FMT_RGB48BE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, big-endian + PIX_FMT_RGB48LE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, little-endian +{$IFEND} +{$IF LIBAVUTIL_VERSION >= 50001000} // 50.01.0 + PIX_FMT_RGB565BE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian + PIX_FMT_RGB565LE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian + PIX_FMT_RGB555BE, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), big-endian, most significant bit to 0 + PIX_FMT_RGB555LE, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), little-endian, most significant bit to 0 + + PIX_FMT_BGR565BE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian + PIX_FMT_BGR565LE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian + PIX_FMT_BGR555BE, ///< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), big-endian, most significant bit to 1 + PIX_FMT_BGR555LE, ///< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), little-endian, most significant bit to 1 + + PIX_FMT_VAAPI_MOCO, ///< HW acceleration through VA API at motion compensation entry-point, Picture.data[3] contains a vaapi_render_state struct which contains macroblocks as well as various fields extracted from headers + PIX_FMT_VAAPI_IDCT, ///< HW acceleration through VA API at IDCT entry-point, Picture.data[3] contains a vaapi_render_state struct which contains fields extracted from headers + PIX_FMT_VAAPI_VLD, ///< HW decoding through VA API, Picture.data[3] contains a vaapi_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers +{$IFEND} PIX_FMT_NB ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions ); const {$ifdef WORDS_BIGENDIAN} - PIX_FMT_RGBA = PIX_FMT_RGB32_1; - PIX_FMT_BGRA = PIX_FMT_BGR32_1; - PIX_FMT_ARGB = PIX_FMT_RGB32; - PIX_FMT_ABGR = PIX_FMT_BGR32; - PIX_FMT_GRAY16 = PIX_FMT_GRAY16BE; + {$IF LIBAVUTIL_VERSION <= 50001000} // 50.01.0 + PIX_FMT_RGBA = PIX_FMT_RGB32_1; + PIX_FMT_BGRA = PIX_FMT_BGR32_1; + PIX_FMT_ARGB = PIX_FMT_RGB32; + PIX_FMT_ABGR = PIX_FMT_BGR32; + {$ELSE} // 50.02.0 + PIX_FMT_RGB32 = PIX_FMT_ARGB; + PIX_FMT_RGB32_1 = PIX_FMT_RGBA; + PIX_FMT_BGR32 = PIX_FMT_ABGR; + PIX_FMT_BGR32_1 = PIX_FMT_BGRA; + {$IFEND} + PIX_FMT_GRAY16 = PIX_FMT_GRAY16BE; + {$IF LIBAVUTIL_VERSION >= 49015000} // 49.15.0 + PIX_FMT_RGB48 = PIX_FMT_RGB48BE; + {$IFEND} + {$IF LIBAVUTIL_VERSION >= 50001000} // 50.01.0 + PIX_FMT_RGB565 = PIX_FMT_RGB565BE; + PIX_FMT_RGB555 = PIX_FMT_RGB555BE; + PIX_FMT_BGR565 = PIX_FMT_BGR565BE; + PIX_FMT_BGR555 = PIX_FMT_BGR555BE + {$IFEND} {$else} - PIX_FMT_RGBA = PIX_FMT_BGR32; - PIX_FMT_BGRA = PIX_FMT_RGB32; - PIX_FMT_ARGB = PIX_FMT_BGR32_1; - PIX_FMT_ABGR = PIX_FMT_RGB32_1; - PIX_FMT_GRAY16 = PIX_FMT_GRAY16LE; -{$endif} + {$IF LIBAVUTIL_VERSION <= 50001000} // 50.01.0 + PIX_FMT_RGBA = PIX_FMT_BGR32; + PIX_FMT_BGRA = PIX_FMT_RGB32; + PIX_FMT_ARGB = PIX_FMT_BGR32_1; + PIX_FMT_ABGR = PIX_FMT_RGB32_1; + {$ELSE} // 50.02.0 + PIX_FMT_RGB32 = PIX_FMT_BGRA; + PIX_FMT_RGB32_1 = PIX_FMT_ABGR; + PIX_FMT_BGR32 = PIX_FMT_RGBA; + PIX_FMT_BGR32_1 = PIX_FMT_ARGB; + {$IFEND} + PIX_FMT_GRAY16 = PIX_FMT_GRAY16LE; + {$IF LIBAVUTIL_VERSION >= 49015000} // 49.15.0 + PIX_FMT_RGB48 = PIX_FMT_RGB48LE; + {$IFEND} + {$IF LIBAVUTIL_VERSION >= 50001000} // 50.01.0 + PIX_FMT_RGB565 = PIX_FMT_RGB565LE; + PIX_FMT_RGB555 = PIX_FMT_RGB555LE; + PIX_FMT_BGR565 = PIX_FMT_BGR565LE; + PIX_FMT_BGR555 = PIX_FMT_BGR555LE; + {$IFEND} +{$ENDIF} {$IF LIBAVUTIL_VERSION_MAJOR < 50} // 50.0.0 PIX_FMT_UYVY411 = PIX_FMT_UYYVYY411; @@ -188,40 +267,41 @@ const PIX_FMT_YUV422 = PIX_FMT_YUYV422; {$IFEND} -(* common.h *) +(* libavutil/common.h *) // until now MKTAG is all from common.h KMS 9/6/2009 -function MKTAG(a,b,c,d: AnsiChar): integer; +function MKTAG(a, b, c, d: AnsiChar): integer; -(* mem.h *) +(* libavutil/mem.h *) +(* memory handling functions *) (** - * Allocate a block of \p size bytes with alignment suitable for all + * Allocates a block of size bytes with alignment suitable for all * memory accesses (including vectors if available on the CPU). * @param size Size in bytes for the memory block to be allocated. - * @return Pointer to the allocated block, NULL if it cannot allocate - * it. + * @return Pointer to the allocated block, NULL if the block cannot + * be allocated. * @see av_mallocz() *) function av_malloc(size: cuint): pointer; cdecl; external av__util; {av_malloc_attrib av_alloc_size(1)} (** - * Allocate or reallocate a block of memory. - * If \p ptr is NULL and \p size > 0, allocate a new block. If \p - * size is zero, free the memory block pointed by \p ptr. + * Allocates or reallocates a block of memory. + * If ptr is NULL and size > 0, allocates a new block. If \p + * size is zero, frees the memory block pointed to by ptr. * @param size Size in bytes for the memory block to be allocated or * reallocated. * @param ptr Pointer to a memory block already allocated with * av_malloc(z)() or av_realloc() or NULL. - * @return Pointer to a newly reallocated block or NULL if it cannot - * reallocate or the function is used to free the memory block. + * @return Pointer to a newly reallocated block or NULL if the block + * cannot be allocated or the function is used to free the memory block. * @see av_fast_realloc() *) function av_realloc(ptr: pointer; size: cuint): pointer; cdecl; external av__util; {av_alloc_size(2)} (** - * Free a memory block which has been allocated with av_malloc(z)() or + * Frees a memory block which has been allocated with av_malloc(z)() or * av_realloc(). * @param ptr Pointer to the memory block which should be freed. * @note ptr = NULL is explicitly allowed. @@ -232,29 +312,28 @@ procedure av_free(ptr: pointer); cdecl; external av__util; (** - * Allocate a block of \p size bytes with alignment suitable for all + * Allocates a block of size bytes with alignment suitable for all * memory accesses (including vectors if available on the CPU) and - * set to zeroes all the bytes of the block. + * zeroes all the bytes of the block. * @param size Size in bytes for the memory block to be allocated. - * @return Pointer to the allocated block, NULL if it cannot allocate - * it. + * @return Pointer to the allocated block, NULL if it cannot be allocated. * @see av_malloc() *) function av_mallocz(size: cuint): pointer; cdecl; external av__util; {av_malloc_attrib av_alloc_size(1)} (** - * Duplicate the string \p s. - * @param s String to be duplicated. + * Duplicates the string s. + * @param s string to be duplicated. * @return Pointer to a newly allocated string containing a - * copy of \p s or NULL if it cannot be allocated. + * copy of \p s or NULL if the string cannot be allocated. *) function av_strdup({const} s: PAnsiChar): PAnsiChar; cdecl; external av__util; {av_malloc_attrib} (** - * Free a memory block which has been allocated with av_malloc(z)() or - * av_realloc() and set to NULL the pointer to it. + * Frees a memory block which has been allocated with av_malloc(z)() or + * av_realloc() and set the pointer pointing to it to NULL. * @param ptr Pointer to the pointer to the memory block which should * be freed. * @see av_free() @@ -262,7 +341,7 @@ function av_strdup({const} s: PAnsiChar): PAnsiChar; procedure av_freep (ptr: pointer); cdecl; external av__util; -(* log.h *) +(* libavutil/log.h *) const {$IF LIBAVUTIL_VERSION_MAJOR < 50} @@ -277,26 +356,26 @@ const AV_LOG_QUIET = -8; (** - * something went really wrong and we will crash now + * Something went really wrong and we will crash now. *) AV_LOG_PANIC = 0; (** - * something went wrong and recovery is not possible - * like no header in a format which depends on it or a combination - * of parameters which are not allowed + * Something went wrong and recovery is not possible. + * For example, no header was found for a format which depends + * on headers or an illegal combination of parameters is used. *) AV_LOG_FATAL = 8; (** - * something went wrong and cannot losslessly be recovered - * but not all future data is affected + * Something went wrong and cannot losslessly be recovered. + * However, not all future data is affected. *) AV_LOG_ERROR = 16; (** - * something somehow does not look correct / something which may or may not - * lead to some problems like use of -vstrict -2 + * Something somehow does not look correct. This may or may not + * lead to problems. An example would be the use of '-vstrict -2'. *) AV_LOG_WARNING = 24; @@ -304,7 +383,7 @@ const AV_LOG_VERBOSE = 40; (** - * stuff which is only useful for libav* developers + * Stuff which is only useful for libav* developers. *) AV_LOG_DEBUG = 48; {$IFEND} @@ -317,7 +396,9 @@ procedure av_log_set_level(level: cint); implementation -function MKTAG(a,b,c,d: AnsiChar): integer; +(* libavutil/common.h *) + +function MKTAG(a, b, c, d: AnsiChar): integer; begin Result := (ord(a) or (ord(b) shl 8) or (ord(c) shl 16) or (ord(d) shl 24)); end; diff --git a/cmake/src/lib/ffmpeg/mathematics.pas b/cmake/src/lib/ffmpeg/mathematics.pas index fb57ccea..92ee0a5e 100644 --- a/cmake/src/lib/ffmpeg/mathematics.pas +++ b/cmake/src/lib/ffmpeg/mathematics.pas @@ -27,6 +27,9 @@ (* * Conversion of libavutil/mathematics.h * revision 16844, Wed Jan 28 08:50:10 2009 UTC + * + * update, MiSchi, no code change + * Fri Jun 12 2009 21:50:00 UTC *) unit mathematics; @@ -55,11 +58,11 @@ const type TAVRounding = ( - AV_ROUND_ZERO = 0, ///< Round toward zero - AV_ROUND_INF = 1, ///< Round away from zero - AV_ROUND_DOWN = 2, ///< Round toward -infinity - AV_ROUND_UP = 3, ///< Round toward +infinity - AV_ROUND_NEAR_INF = 5 ///< Round to nearest and halfway cases away from zero + AV_ROUND_ZERO = 0, ///< Round toward zero. + AV_ROUND_INF = 1, ///< Round away from zero. + AV_ROUND_DOWN = 2, ///< Round toward -infinity. + AV_ROUND_UP = 3, ///< Round toward +infinity. + AV_ROUND_NEAR_INF = 5 ///< Round to nearest and halfway cases away from zero. ); {$IF LIBAVUTIL_VERSION >= 49013000} // 49.13.0 @@ -90,4 +93,3 @@ function av_rescale_q (a: cint64; bq, cq: TAVRational): cint64; implementation end. - diff --git a/cmake/src/lib/ffmpeg/opt.pas b/cmake/src/lib/ffmpeg/opt.pas index 833dc247..a2e2cce9 100644 --- a/cmake/src/lib/ffmpeg/opt.pas +++ b/cmake/src/lib/ffmpeg/opt.pas @@ -28,6 +28,9 @@ (* * Conversion of libavcodec/opt.h * revision 16912, Sun Feb 1 02:00:19 2009 UTC + * + * update, MiSchi, no code change + * Fri Jun 12 2009 21:50:00 UTC *) unit opt; @@ -109,8 +112,8 @@ type {$IF LIBAVCODEC_VERSION >= 51039000} // 51.39.0 (** - * Looks for an option in \p obj. Looks only for the options which - * have the flags set as specified in \p mask and \p flags (that is, + * Looks for an option in obj. Looks only for the options which + * have the flags set as specified in mask and flags (that is, * for which it is the case that opt->flags & mask == flags). * * @param[in] obj a pointer to a struct whose first element is a @@ -135,7 +138,7 @@ function av_set_string(obj: pointer; name: {const} PAnsiChar; val: {const} PAnsi {$IF LIBAVCODEC_VERSION >= 51059000} // 51.59.0 (** * @return a pointer to the AVOption corresponding to the field set or - * NULL if no matching AVOption exists, or if the value \p val is not + * NULL if no matching AVOption exists, or if the value val is not * valid * @see av_set_string3() *) @@ -167,8 +170,11 @@ function av_set_string2(obj: Pointer; name: {const} PAnsiChar; val: {const} PAns * @param alloc when 1 then the old value will be av_freed() and the * new av_strduped() * when 0 then no av_free() nor av_strdup() will be used - * @return 0 if the value has been set, an AVERROR* error code if no - * matching option exists, or if the value \p val is not valid + * @return 0 if the value has been set, or an AVERROR code in case of + * error: + * AVERROR(ENOENT) if no matching option exists + * AVERROR(ERANGE) if the value is out of range + * AVERROR(EINVAL) if the value is not valid *) function av_set_string3(obj: Pointer; name: {const} PAnsiChar; val: {const} PAnsiChar; alloc: cint; out o_out: {const} PAVOption): cint; cdecl; external av__codec; diff --git a/cmake/src/lib/ffmpeg/rational.pas b/cmake/src/lib/ffmpeg/rational.pas index 6762aa26..b940009d 100644 --- a/cmake/src/lib/ffmpeg/rational.pas +++ b/cmake/src/lib/ffmpeg/rational.pas @@ -28,6 +28,9 @@ (* * Conversion of libavutil/rational.h * revision 16912, Sun Feb 1 02:00:19 2009 UTC + * + * update, MiSchi, no code change + * Fri Jun 12 2009 22:20:00 UTC *) unit rational; @@ -135,22 +138,20 @@ function av_d2q(d: cdouble; max: cint): TAVRational; cdecl; external av__util; {av_const} {$IF LIBAVUTIL_VERSION >= 49011000} // 49.11.0 - (** - * @return 1 if \q1 is nearer to \p q than \p q2, -1 if \p q2 is nearer - * than \p q1, 0 if they have the same distance. + * @return 1 if q1 is nearer to q than q2, -1 if q2 is nearer + * than q1, 0 if they have the same distance. *) function av_nearer_q(q, q1, q2: TAVRational): cint; cdecl; external av__util; (** - * Finds the nearest value in \p q_list to \p q. + * Finds the nearest value in q_list to q. * @param q_list an array of rationals terminated by {0, 0} * @return the index of the nearest value found in the array *) function av_find_nearest_q_idx(q: TAVRational; q_list: {const} PAVRationalArray): cint; cdecl; external av__util; - {$IFEND} implementation diff --git a/cmake/src/lib/ffmpeg/swscale.pas b/cmake/src/lib/ffmpeg/swscale.pas index 965659d9..c0aabf45 100644 --- a/cmake/src/lib/ffmpeg/swscale.pas +++ b/cmake/src/lib/ffmpeg/swscale.pas @@ -45,12 +45,13 @@ interface uses ctypes, avutil, + avcodec, UConfig; const (* Max. supported version by this header *) LIBSWSCALE_MAX_VERSION_MAJOR = 0; - LIBSWSCALE_MAX_VERSION_MINOR = 6; + LIBSWSCALE_MAX_VERSION_MINOR = 7; LIBSWSCALE_MAX_VERSION_RELEASE = 1; LIBSWSCALE_MAX_VERSION = (LIBSWSCALE_MAX_VERSION_MAJOR * VERSION_MAJOR) + (LIBSWSCALE_MAX_VERSION_MINOR * VERSION_MINOR) + @@ -78,7 +79,7 @@ function swscale_version(): cuint; {$IFEND} const - {* values for the flags, the stuff on the command line is different *} + (* values for the flags, the stuff on the command line is different *) SWS_FAST_BILINEAR = 1; SWS_BILINEAR = 2; SWS_BICUBIC = 4; @@ -98,10 +99,10 @@ const SWS_PRINT_INFO = $1000; - //the following 3 flags are not completely implemented - //internal chrominace subsampling info + // the following 3 flags are not completely implemented + // internal chrominace subsampling info SWS_FULL_CHR_H_INT = $2000; - //input subsampling info + // input subsampling info SWS_FULL_CHR_H_INP = $4000; SWS_DIRECT_BGR = $8000; SWS_ACCURATE_RND = $40000; @@ -123,15 +124,14 @@ const SWS_CS_SMPTE240M = 7; SWS_CS_DEFAULT = 5; - type // when used for filters they must have an odd number of elements // coeffs cannot be shared between vectors PSwsVector = ^TSwsVector; TSwsVector = record - coeff: PCdouble; - length: cint; + coeff: PCdouble; // pointer to the list of coefficients + length: cint; // number of coefficients in the vector end; // vectors can be shared @@ -148,63 +148,179 @@ type {internal structure} end; - procedure sws_freeContext(swsContext: PSwsContext); cdecl; external sw__scale; +(** + * Allocates and returns a SwsContext. You need it to perform + * scaling/conversion operations using sws_scale(). + * + * @param srcW the width of the source image + * @param srcH the height of the source image + * @param srcFormat the source image format + * @param dstW the width of the destination image + * @param dstH the height of the destination image + * @param dstFormat the destination image format + * @param flags specify which algorithm and options to use for rescaling + * @return a pointer to an allocated context, or NULL in case of error + *) function sws_getContext(srcW: cint; srcH: cint; srcFormat: TAVPixelFormat; - dstW: cint; dstH: cint; dstFormat: TAVPixelFormat; flags: cint; - srcFilter: PSwsFilter; dstFilter: PSwsFilter; param: PCdouble): PSwsContext; + dstW: cint; dstH: cint; dstFormat: TAVPixelFormat; + flags: cint; srcFilter: PSwsFilter; + dstFilter: PSwsFilter; param: PCdouble): PSwsContext; cdecl; external sw__scale; -function sws_scale(context: PSwsContext; src: PPCuint8Array; srcStride: PCintArray; srcSliceY: cint; srcSliceH: cint; - dst: PPCuint8Array; dstStride: PCintArray): cint; + +(** + * Scales the image slice in srcSlice and puts the resulting scaled + * slice in the image in dst. A slice is a sequence of consecutive + * rows in an image. + * + * @param context the scaling context previously created with + * sws_getContext() + * @param srcSlice the array containing the pointers to the planes of + * the source slice + * @param srcStride the array containing the strides for each plane of + * the source image + * @param srcSliceY the position in the source image of the slice to + * process, that is the number (counted starting from + * zero) in the image of the first row of the slice + * @param srcSliceH the height of the source slice, that is the number + * of rows in the slice + * @param dst the array containing the pointers to the planes of + * the destination image + * @param dstStride the array containing the strides for each plane of + * the destination image + * @return the height of the output slice + *) +function sws_scale(context: PSwsContext; srcSlice: PPCuint8Array; srcStride: PCintArray; + srcSliceY: cint; srcSliceH: cint; dst: PPCuint8Array; dstStride: PCintArray): cint; cdecl; external sw__scale; -function sws_scale_ordered(context: PSwsContext; src: PPCuint8Array; srcStride: PCintArray; srcSliceY: cint; - srcSliceH: cint; dst: PPCuint8Array; dstStride: PCintArray): cint; + +{$IF LIBSWSCALE_VERSION_MAJOR < 1} +// deprecated. Use sws_scale() instead. +function sws_scale_ordered(context: PSwsContext; src: PPCuint8Array; srcStride: PCintArray; + srcSliceY: cint; srcSliceH: cint; dst: PPCuint8Array; dstStride: PCintArray): cint; cdecl; external sw__scale; deprecated; +{$IFEND} -function sws_setColorspaceDetails(c: PSwsContext; inv_table: PQuadCintArray; srcRange: cint; table: PQuadCintArray; dstRange: cint; +(** + * @param inv_table the yuv2rgb coefficients, normally ff_yuv2rgb_coeffs[x] + * @param fullRange if 1 then the luma range is 0..255 if 0 it is 16..235 + * @return -1 if not supported + *) +function sws_setColorspaceDetails(c: PSwsContext; inv_table: PQuadCintArray; + srcRange: cint; table: PQuadCintArray; dstRange: cint; brightness: cint; contrast: cint; saturation: cint): cint; cdecl; external sw__scale; -function sws_getColorspaceDetails(c: PSwsContext; var inv_table: PQuadCintArray; var srcRange: cint; var table: PQuadCintArray; var dstRange: cint; + +(** + * @return -1 if not supported + *) +function sws_getColorspaceDetails(c: PSwsContext; var inv_table: PQuadCintArray; + var srcRange: cint; var table: PQuadCintArray; var dstRange: cint; var brightness: cint; var contrast: cint; var saturation: cint): cint; cdecl; external sw__scale; + +(** + * Returns a normalized Gaussian curve used to filter stuff + * quality=3 is high quality, lower is lower quality. + *) function sws_getGaussianVec(variance: cdouble; quality: cdouble): PSwsVector; cdecl; external sw__scale; + +(** + * Allocates and returns a vector with length coefficients, all + * with the same value c. + *) function sws_getConstVec(c: cdouble; length: cint): PSwsVector; cdecl; external sw__scale; + +(** + * Allocates and returns a vector with just one coefficient, with + * value 1.0. + *) function sws_getIdentityVec: PSwsVector; cdecl; external sw__scale; + +(** + * Scales all the coefficients of a by the scalar value. + *) procedure sws_scaleVec(a: PSwsVector; scalar: cdouble); cdecl; external sw__scale; + +(** + * Scales all the coefficients of a so that their sum equals height. + *) procedure sws_normalizeVec(a: PSwsVector; height: cdouble); cdecl; external sw__scale; + procedure sws_convVec(a: PSwsVector; b: PSwsVector); cdecl; external sw__scale; + procedure sws_addVec(a: PSwsVector; b: PSwsVector); cdecl; external sw__scale; + procedure sws_subVec(a: PSwsVector; b: PSwsVector); cdecl; external sw__scale; + procedure sws_shiftVec(a: PSwsVector; shift: cint); cdecl; external sw__scale; + +(** + * Allocates and returns a clone of the vector a, that is a vector + * with the same coefficients as a. + *) function sws_cloneVec(a: PSwsVector): PSwsVector; cdecl; external sw__scale; +{$IF LIBSWSCALE_VERSION_MAJOR < 1} +// deprecated Use sws_printVec2() instead. + procedure sws_printVec(a: PSwsVector); + cdecl; external sw__scale; deprecated; +{$IFEND} + +{$IF LIBSWSCALE_VERSION >= 000007000} // >= 0.7.0 +(** + * Prints with av_log() a textual representation of the vector a + * if log_level <= av_log_level. + *) +procedure sws_printVec2(a: PSwsVector; + log_ctx: PAVClass; // PAVClass is declared in avcodec.pas + log_level: cint); cdecl; external sw__scale; +{$IFEND} + procedure sws_freeVec(a: PSwsVector); cdecl; external sw__scale; -function sws_getDefaultFilter(lumaGBlur: cfloat; chromaGBlur: cfloat; lumaSarpen: cfloat; chromaSharpen: cfloat; chromaHShift: cfloat; - chromaVShift: cfloat; verbose: cint): PSwsFilter; +function sws_getDefaultFilter(lumaGBlur: cfloat; chromaGBlur: cfloat; + lumaSharpen: cfloat; chromaSharpen: cfloat; + chromaHShift: cfloat; chromaVShift: cfloat; + verbose: cint): PSwsFilter; cdecl; external sw__scale; + procedure sws_freeFilter(filter: PSwsFilter); cdecl; external sw__scale; +(** + * Checks if context can be reused, otherwise reallocates a new + * one. + * + * If context is NULL, just calls sws_getContext() to get a new + * context. Otherwise, checks if the parameters are the ones already + * saved in context. If that is the case, returns the current + * context. Otherwise, frees context and gets a new context with + * the new parameters. + * + * Be warned that srcFilter and dstFilter are not checked, they + * are assumed to remain the same. + *) function sws_getCachedContext(context: PSwsContext; - srcW: cint; srcH: cint; srcFormat: cint; - dstW: cint; dstH: cint; dstFormat: cint; flags: cint; - srcFilter: PSwsFilter; dstFilter: PSwsFilter; param: PCdouble): PSwsContext; + srcW: cint; srcH: cint; srcFormat: TAVPixelFormat; + dstW: cint; dstH: cint; dstFormat: TAVPixelFormat; + flags: cint; srcFilter: PSwsFilter; + dstFilter: PSwsFilter; param: PCdouble): PSwsContext; cdecl; external sw__scale; implementation diff --git a/cmake/src/media/UAudioDecoder_FFmpeg.pas b/cmake/src/media/UAudioDecoder_FFmpeg.pas index f62cb92c..97d8a8df 100644 --- a/cmake/src/media/UAudioDecoder_FFmpeg.pas +++ b/cmake/src/media/UAudioDecoder_FFmpeg.pas @@ -378,14 +378,14 @@ begin // try standard format SampleFormat := asfS16; end; - + if CodecCtx^.channels > 255 then + Log.LogStatus('Error: CodecCtx^.channels > 255', 'TFFmpegDecodeStream.Open'); FormatInfo := TAudioFormatInfo.Create( - CodecCtx^.channels, + byte(CodecCtx^.channels), CodecCtx^.sample_rate, SampleFormat ); - PacketQueue := TPacketQueue.Create(); // finally start the decode thread @@ -446,7 +446,9 @@ end; function TFFmpegDecodeStream.GetLength(): real; begin - // do not forget to consider the start_time value here + // do not forget to consider the start_time value here + // there is a type size mismatch warnign because start_time and duration are cint64. + // So, in principle there could be an overflow when doing the sum. Result := (FormatCtx^.start_time + FormatCtx^.duration) / AV_TIME_BASE; end; diff --git a/cmake/src/media/UVideo.pas b/cmake/src/media/UVideo.pas index 35f8ab4d..f55690b2 100644 --- a/cmake/src/media/UVideo.pas +++ b/cmake/src/media/UVideo.pas @@ -697,6 +697,12 @@ begin 0, fCodecContext^.Height, @(fAVFrameRGB.data), @(fAVFrameRGB.linesize)); {$ELSE} + // img_convert from lib/ffmpeg/avcodec.pas is actually deprecated. + // If ./configure does not find SWScale then this gives the error + // that the identifier img_convert is not known or similar. + // I think this should be removed, but am not sure whether there should + // be some other replacement or a warning, Therefore, I leave it for now. + // April 2009, mischi errnum := img_convert(PAVPicture(fAVFrameRGB), PIXEL_FMT_FFMPEG, PAVPicture(fAVFrame), fCodecContext^.pix_fmt, fCodecContext^.width, fCodecContext^.height); diff --git a/cmake/src/menu/UDisplay.pas b/cmake/src/menu/UDisplay.pas index 58c416db..f2eb2ced 100644 --- a/cmake/src/menu/UDisplay.pas +++ b/cmake/src/menu/UDisplay.pas @@ -45,7 +45,7 @@ type TDisplay = class private //fade-to-black-hack - BlackScreen: boolean; + BlackScreen: boolean; FadeEnabled: boolean; // true if fading is enabled FadeFailed: boolean; // true if fading is possible (enough memory, etc.) @@ -60,6 +60,17 @@ type OSD_LastError: string; + { software cursor data } + Cursor_X: double; + Cursor_Y: double; + Cursor_Pressed: boolean; + Cursor_HiddenByScreen: boolean; // hides software cursor and deactivate auto fade in + + // used for cursor fade out when there is no movement + Cursor_Visible: boolean; + Cursor_LastMove: cardinal; + Cursor_Fade: boolean; + procedure DrawDebugInformation; public NextScreen: PMenu; @@ -78,10 +89,27 @@ type procedure SaveScreenShot; function Draw: boolean; + + { sets SDL_ShowCursor depending on options set in Ini } + procedure SetCursor; + + { called when cursor moves, positioning of software cursor } + procedure MoveCursor(X, Y: double; Pressed: boolean); + + + { draws software cursor } + procedure DrawCursor; end; var - Display: TDisplay; + Display: TDisplay; + +const + { constants for software cursor effects + time in milliseconds } + Cursor_FadeIn_Time = 500; // seconds the fade in effect lasts + Cursor_FadeOut_Time = 2000; // seconds the fade out effect lasts + Cursor_AutoHide_Time = 5000; // seconds until auto fade out starts if there is no mouse movement implementation @@ -110,9 +138,9 @@ begin BlackScreen := false; // fade mod - FadeState := 0; + FadeState := 0; FadeEnabled := (Ini.ScreenFade = 1); - FadeFailed:= false; + FadeFailed := false; glGenTextures(2, @FadeTex); @@ -125,6 +153,15 @@ begin //Set LastError for OSD to No Error OSD_LastError := 'No Errors'; + + // software cursor default values + Cursor_LastMove := 0; + Cursor_Visible := false; + Cursor_Pressed := false; + Cursor_X := -1; + Cursor_Y := -1; + Cursor_Fade := false; + Cursor_HiddenByScreen := true; end; destructor TDisplay.Destroy; @@ -306,6 +343,162 @@ begin if ((Ini.Debug = 1) or (Params.Debug)) and (S = 1) then DrawDebugInformation; end; // for + + if not BlackScreen then + DrawCursor; +end; + +{ sets SDL_ShowCursor depending on options set in Ini } +procedure TDisplay.SetCursor; +var + Cursor: Integer; +begin + Cursor := 0; + + if (CurrentScreen <> @ScreenSing) or (Cursor_HiddenByScreen) then + begin // hide cursor on singscreen + if (Ini.Mouse = 0) and (Ini.FullScreen = 0) then + // show sdl (os) cursor in window mode even when mouse support is off + Cursor := 1 + else if (Ini.Mouse = 1) then + // show sdl (os) cursor when hardware cursor is selected + Cursor := 1; + + if (Ini.Mouse <> 2) then + Cursor_HiddenByScreen := false; + end + else if (Ini.Mouse <> 2) then + Cursor_HiddenByScreen := true; + + + SDL_ShowCursor(Cursor); + + if (Ini.Mouse = 2) then + begin + if Cursor_HiddenByScreen then + begin + // show software cursor + Cursor_HiddenByScreen := false; + Cursor_Visible := false; + Cursor_Fade := false; + end + else if (CurrentScreen = @ScreenSing) then + begin + // hide software cursor in singscreen + Cursor_HiddenByScreen := true; + Cursor_Visible := false; + Cursor_Fade := false; + end; + end; +end; + +{ called when cursor moves, positioning of software cursor } +procedure TDisplay.MoveCursor(X, Y: double; Pressed: boolean); +var + Ticks: cardinal; +begin + if (Ini.Mouse = 2) and + ((X <> Cursor_X) or (Y <> Cursor_Y) or (Pressed <> Cursor_Pressed)) then + begin + Cursor_X := X; + Cursor_Y := Y; + Cursor_Pressed := Pressed; + + Ticks := SDL_GetTicks; + + { fade in on movement (or button press) if not first movement } + if (not Cursor_Visible) and (Cursor_LastMove <> 0) then + begin + if Cursor_Fade then // we use a trick here to consider progress of fade out + Cursor_LastMove := Ticks - round(Cursor_FadeIn_Time * (1 - (Ticks - Cursor_LastMove)/Cursor_FadeOut_Time)) + else + Cursor_LastMove := Ticks; + + Cursor_Visible := true; + Cursor_Fade := true; + end + else if not Cursor_Fade then + begin + Cursor_LastMove := Ticks; + end; + end; +end; + +{ draws software cursor } +procedure TDisplay.DrawCursor; +var + Alpha: single; + Ticks: cardinal; +begin + if (Ini.Mouse = 2) then + begin // draw software cursor + Ticks := SDL_GetTicks; + + if (Cursor_Visible) and (Cursor_LastMove + Cursor_AutoHide_Time <= Ticks) then + begin // start fade out after 5 secs w/o activity + Cursor_Visible := false; + Cursor_LastMove := Ticks; + Cursor_Fade := true; + end; + + // fading + if Cursor_Fade then + begin + if Cursor_Visible then + begin // fade in + if (Cursor_LastMove + Cursor_FadeIn_Time <= Ticks) then + Cursor_Fade := false + else + Alpha := sin((Ticks - Cursor_LastMove) * 0.5 * pi / Cursor_FadeIn_Time) * 0.7; + end + else + begin //fade out + if (Cursor_LastMove + Cursor_FadeOut_Time <= Ticks) then + Cursor_Fade := false + else + Alpha := cos((Ticks - Cursor_LastMove) * 0.5 * pi / Cursor_FadeOut_Time) * 0.7; + end; + end; + + // no else if here because we may turn off fade in if block + if not Cursor_Fade then + begin + if Cursor_Visible then + Alpha := 0.7 // alpha when cursor visible and not fading + else + Alpha := 0; // alpha when cursor is hidden + end; + + if (Alpha > 0) and (not Cursor_HiddenByScreen) then + begin + glColor4f(1, 1, 1, Alpha); + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glDisable(GL_DEPTH_TEST); + + if (Cursor_Pressed) and (Tex_Cursor_Pressed.TexNum > 0) then + glBindTexture(GL_TEXTURE_2D, Tex_Cursor_Pressed.TexNum) + else + glBindTexture(GL_TEXTURE_2D, Tex_Cursor_Unpressed.TexNum); + + glBegin(GL_QUADS); + glTexCoord2f(0, 0); + glVertex2f(Cursor_X, Cursor_Y); + + glTexCoord2f(0, 1); + glVertex2f(Cursor_X, Cursor_Y + 32); + + glTexCoord2f(1, 1); + glVertex2f(Cursor_X + 32, Cursor_Y + 32); + + glTexCoord2f(1, 0); + glVertex2f(Cursor_X + 32, Cursor_Y); + glEnd; + + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); + end; + end; end; procedure TDisplay.SaveScreenShot; @@ -360,10 +553,11 @@ begin end; //------------ -// DrawDebugInformation - Procedure draw FPS and some other Informations on Screen +// DrawDebugInformation - procedure draw fps and some other informations on screen //------------ procedure TDisplay.DrawDebugInformation; -var Ticks: cardinal; +var + Ticks: cardinal; begin // Some White Background for information glEnable(GL_BLEND); @@ -377,13 +571,13 @@ begin glEnd; glDisable(GL_BLEND); -// Set Font Specs +// set font specs SetFontStyle(0); SetFontSize(21); SetFontItalic(false); glColor4f(0, 0, 0, 1); -// Calculate FPS +// calculate fps Ticks := SDL_GetTicks(); if (Ticks >= NextFPSSwap) then begin @@ -394,17 +588,17 @@ begin Inc(FPSCounter); -// Draw Text +// draw text -// FPS +// fps SetFontPos(695, 0); glPrint ('FPS: ' + InttoStr(LastFPS)); -// RSpeed +// rspeed SetFontPos(695, 13); glPrint ('RSpeed: ' + InttoStr(Round(1000 * TimeMid))); -// LastError +// lasterror SetFontPos(695, 26); glColor4f(1, 0, 0, 1); glPrint (OSD_LastError); diff --git a/cmake/src/menu/UMenu.pas b/cmake/src/menu/UMenu.pas index f86746ed..a3f47b3d 100644 --- a/cmake/src/menu/UMenu.pas +++ b/cmake/src/menu/UMenu.pas @@ -34,19 +34,20 @@ interface {$I switches.inc} uses - gl, SysUtils, - UTexture, - UMenuStatic, - UMenuText, - UMenuButton, - UMenuSelectSlide, - UMenuInteract, + Math, + gl, + SDL, UMenuBackground, - UThemes, + UMenuButton, UMenuButtonCollection, - Math, - UMusic; + UMenuInteract, + UMenuSelectSlide, + UMenuStatic, + UMenuText, + UMusic, + UTexture, + UThemes; type { Int16 = SmallInt;} @@ -61,7 +62,7 @@ type ButtonPos: integer; Button: array of TButton; - + SelectsS: array of TSelectSlide; ButtonCollection: array of TButtonCollection; public @@ -72,6 +73,7 @@ type Fade: integer; // fade type ShowFinish: boolean; // true if there is no fade + RightMbESC: boolean; // true to simulate ESC keypress when RMB is pressed destructor Destroy; override; constructor Create; overload; virtual; @@ -82,10 +84,10 @@ type function WideCharUpperCase(wchar: WideChar) : WideString; function WideStringUpperCase(wstring: WideString) : WideString; procedure AddInteraction(Typ, Num: integer); - procedure SetInteraction(Num: integer); + procedure SetInteraction(Num: integer); virtual; property Interaction: integer read SelInteraction write SetInteraction; - //Procedure Load BG, Texts, Statics and Button Collections from ThemeBasic + // procedure load bg, texts, statics and button collections from themebasic procedure LoadFromTheme(const ThemeBasic: TThemeBasic); procedure PrepareButtonCollections(const Collections: AThemeButtonCollection); @@ -145,9 +147,10 @@ type function DrawFG: boolean; virtual; function Draw: boolean; virtual; function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown : boolean): boolean; virtual; - // FIXME: ParseMouse is not implemented in any subclass and not even used anywhere in the code - // -> do this before activation of this method - //function ParseMouse(Typ: integer; X: integer; Y: integer): boolean; virtual; abstract; + function ParseMouse(MouseButton: integer; BtnDown: boolean; X, Y: integer): boolean; virtual; + function InRegion(X1, Y1, W, H, X, Y: real): boolean; + function InteractAt(X, Y: real): integer; + function CollectionAt(X, Y: real): integer; procedure onShow; virtual; procedure onShowFinish; virtual; procedure onHide; virtual; @@ -167,6 +170,9 @@ type end; const + MENU_MDOWN = 8; + MENU_MUP = 0; + pmMove = 1; pmClick = 2; pmUnClick = 3; @@ -183,14 +189,14 @@ implementation uses UCommon, - ULog, - UMain, + UCovers, + UDisplay, UDrawTexture, UGraphic, - UDisplay, - UCovers, - UTime, + ULog, + UMain, USkins, + UTime, //Background types UMenuBackgroundNone, UMenuBackgroundColor, @@ -221,6 +227,8 @@ begin ButtonPos := -1; Background := nil; + + RightMbESC := true; end; { constructor TMenu.Create(Back: string); @@ -252,7 +260,7 @@ begin BackH := H; end; } -function RGBFloatToInt(R, G, B: Double): cardinal; +function RGBFloatToInt(R, G, B: double): cardinal; begin Result := (Trunc(255 * R) shl 16) or (Trunc(255 * G) shl 8) or @@ -291,8 +299,8 @@ begin begin Button[OldNum].Selected := false; - //Deselect Collection if Next Button is Not from Collection - if (NewTyp <> iButton) Or (Button[NewNum].Parent <> Button[OldNum].Parent) then + // deselect collection if next button is not from collection + if (NewTyp <> iButton) or (Button[NewNum].Parent <> Button[OldNum].Parent) then ButtonCollection[Button[OldNum].Parent-1].Selected := false; end; end; @@ -596,17 +604,25 @@ begin Result := AddStatic(X, Y, W, H, Name, TEXTURE_TYPE_PLAIN); end; -function TMenu.AddStatic(X, Y, W, H: real; ColR, ColG, ColB: real; const Name: string; Typ: TTextureType): integer; +function TMenu.AddStatic(X, Y, W, H: real; + ColR, ColG, ColB: real; + const Name: string; + Typ: TTextureType): integer; begin Result := AddStatic(X, Y, W, H, ColR, ColG, ColB, Name, Typ, $FFFFFF); end; -function TMenu.AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; const Name: string; Typ: TTextureType): integer; +function TMenu.AddStatic(X, Y, W, H, Z: real; + ColR, ColG, ColB: real; + const Name: string; + Typ: TTextureType): integer; begin Result := AddStatic(X, Y, W, H, Z, ColR, ColG, ColB, Name, Typ, $FFFFFF); end; -function TMenu.AddStatic(X, Y, W, H: real; const Name: string; Typ: TTextureType): integer; +function TMenu.AddStatic(X, Y, W, H: real; + const Name: string; + Typ: TTextureType): integer; var StatNum: integer; begin @@ -624,17 +640,32 @@ begin Result := StatNum; end; -function TMenu.AddStatic(X, Y, W, H: real; ColR, ColG, ColB: real; const Name: string; Typ: TTextureType; Color: integer): integer; +function TMenu.AddStatic(X, Y, W, H: real; + ColR, ColG, ColB: real; + const Name: string; + Typ: TTextureType; + Color: integer): integer; begin Result := AddStatic(X, Y, W, H, 0, ColR, ColG, ColB, Name, Typ, Color); end; -function TMenu.AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; const Name: string; Typ: TTextureType; Color: integer): integer; +function TMenu.AddStatic(X, Y, W, H, Z: real; + ColR, ColG, ColB: real; + const Name: string; + Typ: TTextureType; + Color: integer): integer; begin Result := AddStatic(X, Y, W, H, Z, ColR, ColG, ColB, 0, 0, 1, 1, Name, Typ, Color, false, 0); end; -function TMenu.AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; TexX1, TexY1, TexX2, TexY2: real; const Name: string; Typ: TTextureType; Color: integer; Reflection: boolean; ReflectionSpacing: real): integer; +function TMenu.AddStatic(X, Y, W, H, Z: real; + ColR, ColG, ColB: real; + TexX1, TexY1, TexX2, TexY2: real; + const Name: string; + Typ: TTextureType; + Color: integer; + Reflection: boolean; + ReflectionSpacing: real): integer; var StatNum: integer; begin @@ -652,12 +683,22 @@ begin begin Static[StatNum] := TStatic.Create(Texture.GetTexture(Name, Typ, Color)); // new skin end; - + // configures static Static[StatNum].Texture.X := X; Static[StatNum].Texture.Y := Y; - Static[StatNum].Texture.W := W; - Static[StatNum].Texture.H := H; + + //Set height and width via sprite size if omitted + if(H = 0) then + Static[StatNum].Texture.H := Static[StatNum].Texture.H + else + Static[StatNum].Texture.H := H; + + if(W = 0) then + Static[StatNum].Texture.W := Static[StatNum].Texture.W + else + Static[StatNum].Texture.W := W; + Static[StatNum].Texture.Z := Z; if (Typ <> TEXTURE_TYPE_COLORIZED) then begin @@ -696,12 +737,22 @@ begin Result := TextNum; end; -function TMenu.AddText(X, Y: real; Style: integer; Size, ColR, ColG, ColB: real; const Text: string): integer; +function TMenu.AddText(X, Y: real; + Style: integer; + Size, ColR, ColG, ColB: real + ; const Text: string): integer; begin Result := AddText(X, Y, 0, Style, Size, ColR, ColG, ColB, 0, Text, false, 0, 0); end; -function TMenu.AddText(X, Y, W: real; Style: integer; Size, ColR, ColG, ColB: real; Align: integer; const Text_: string; Reflection_: boolean; ReflectionSpacing_: real; Z : real): integer; +function TMenu.AddText(X, Y, W: real; + Style: integer; + Size, ColR, ColG, ColB: real; + Align: integer; + const Text_: string; + Reflection_: boolean; + ReflectionSpacing_: real; + Z : real): integer; var TextNum: integer; begin @@ -771,10 +822,10 @@ begin ThemeButton.Text[BT].Text); end; - //BAutton Collection Mod + // bautton collection mod if (ThemeButton.Parent <> 0) then begin - //If Collection Exists then Change Interaction to Child Button + // if collection exists then change interaction to child button if (@ButtonCollection[ThemeButton.Parent-1] <> nil) then begin Interactions[High(Interactions)].Typ := iBCollectionChild; @@ -803,8 +854,10 @@ begin end; function TMenu.AddButton(X, Y, W, H, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt: real; - const Name: string; Typ: TTextureType; - Reflection: boolean; ReflectionSpacing, DeSelectReflectionSpacing: real): integer; + const Name: string; + Typ: TTextureType; + Reflection: boolean; + ReflectionSpacing, DeSelectReflectionSpacing: real): integer; begin // adds button //SetLength is used once to reduce Memory usement @@ -857,7 +910,7 @@ begin Button[Result].Reflectionspacing := ReflectionSpacing; Button[Result].DeSelectReflectionspacing := DeSelectReflectionSpacing; - //Button Collection Mod + // button collection mod Button[Result].Parent := 0; // adds interaction @@ -870,11 +923,10 @@ begin Setlength(Button, 0); end; -// Method to draw our TMenu and all his child buttons +// method to draw our tmenu and all his child buttons function TMenu.DrawBG: boolean; begin Background.Draw; - Result := true; end; @@ -993,9 +1045,10 @@ begin Int := Int - ceil(Length(Interactions) / 2); //Set Interaction - if ((Int < 0) or (Int > Length(Interactions) - 1)) - then Int := Interaction //nonvalid button, keep current one - else Interaction := Int; //select row above + if ((Int < 0) or (Int > Length(Interactions) - 1)) then + Int := Interaction // invalid button, keep current one + else + Interaction := Int; // select row above end; procedure TMenu.InteractNextRow; @@ -1007,9 +1060,10 @@ begin Int := Int + ceil(Length(Interactions) / 2); //Set Interaction - if ((Int < 0) or (Int > Length(Interactions) - 1)) - then Int := Interaction //nonvalid button, keep current one - else Interaction := Int; //select row above + if ((Int < 0) or (Int > Length(Interactions) - 1)) then + Int := Interaction // invalid button, keep current one + else + Interaction := Int; // select row above end; procedure TMenu.InteractNext; @@ -1023,7 +1077,8 @@ begin Int := (Int + 1) mod Length(Interactions); //If no Interaction is Selectable Simply Select Next - if (Int = Interaction) then Break; + if (Int = Interaction) then + Break; until IsSelectable(Int); @@ -1040,10 +1095,12 @@ begin // change interaction as long as it's needed repeat Int := Int - 1; - if Int = -1 then Int := High(Interactions); + if Int = -1 then + Int := High(Interactions); //If no Interaction is Selectable Simply Select Next - if (Int = Interaction) then Break; + if (Int = Interaction) then + Break; until IsSelectable(Int); //Set Interaction @@ -1068,7 +1125,8 @@ begin while (Again = true) do begin Num := SelInteraction - CustomSwitch; - if Num = -1 then Num := High(Interactions); + if Num = -1 then + Num := High(Interactions); Interaction := Num; Again := false; // reset, default to accept changing interaction @@ -1212,6 +1270,9 @@ begin SelectsS[High(SelectsS)].Texture.Z := ThemeSelectS.Z; SelectsS[High(SelectsS)].TextureSBG.Z := ThemeSelectS.Z; + SelectsS[High(SelectsS)].showArrows := ThemeSelectS.showArrows; + SelectsS[High(SelectsS)].oneItemOnly := ThemeSelectS.oneItemOnly; + //Generate Lines SelectsS[High(SelectsS)].GenLines; @@ -1255,9 +1316,20 @@ begin else SelectsS[S].TextureSBG := Texture.GetTexture(SBGName, SBGTyp); + SelectsS[High(SelectsS)].Tex_SelectS_ArrowL := Tex_SelectS_ArrowL; + SelectsS[High(SelectsS)].Tex_SelectS_ArrowL.X := X + W + SkipX; + SelectsS[High(SelectsS)].Tex_SelectS_ArrowL.Y := Y; + SelectsS[High(SelectsS)].Tex_SelectS_ArrowL.W := Tex_SelectS_ArrowL.W; + SelectsS[High(SelectsS)].Tex_SelectS_ArrowL.H := Tex_SelectS_ArrowL.H; + + SelectsS[High(SelectsS)].Tex_SelectS_ArrowR := Tex_SelectS_ArrowR; + SelectsS[High(SelectsS)].Tex_SelectS_ArrowR.X := X + W + SkipX + SBGW - Tex_SelectS_ArrowR.W; + SelectsS[High(SelectsS)].Tex_SelectS_ArrowR.Y := Y; + SelectsS[High(SelectsS)].Tex_SelectS_ArrowR.W := Tex_SelectS_ArrowR.W; + SelectsS[High(SelectsS)].Tex_SelectS_ArrowR.H := Tex_SelectS_ArrowR.H; + SelectsS[S].TextureSBG.X := X + W + SkipX; SelectsS[S].TextureSBG.Y := Y; - //SelectsS[S].TextureSBG.W := 450; SelectsS[S].SBGW := SBGW; SelectsS[S].TextureSBG.H := H; SelectsS[S].SBGColR := SBGColR; @@ -1355,10 +1427,12 @@ begin SetLength(SelectsS[SelectNo].TextOptT, SO + 1); SelectsS[SelectNo].TextOptT[SO] := AddText; +{ + SelectsS[S].SelectedOption := SelectsS[S].SelectOptInt; // refresh - //SelectsS[S].SelectedOption := SelectsS[S].SelectOptInt; // refresh - - //if SO = Selects[S].PData^ then Selects[S].SelectedOption := SO; + if SO = Selects[S].PData^ then + Selects[S].SelectedOption := SO; +} end; procedure TMenu.UpdateSelectSlideOptions(ThemeSelectSlide: TThemeSelectSlide; SelectNum: integer; Values: array of string; var Data: integer); @@ -1458,11 +1532,11 @@ begin end; end; end; - //interact Prev if there is Nothing to Change + // interact prev if there is nothing to change else begin InteractPrev; - //If ButtonCollection with more than 1 Entry then Select Last Entry + // if buttoncollection with more than 1 entry then select last entry if (Button[Interactions[Interaction].Num].Parent <> 0) and (ButtonCollection[Button[Interactions[Interaction].Num].Parent-1].CountChilds > 1) then begin //Select Last Child @@ -1571,10 +1645,120 @@ begin Result := true; end; +function TMenu.ParseMouse(MouseButton: integer; BtnDown: boolean; X, Y: integer): boolean; +var + nBut: integer; +begin + //default mouse parsing: clicking generates return keypress, + // mousewheel selects in select slide + //override ParseMouse to customize + Result := true; + + if RightMbESC and (MouseButton = SDL_BUTTON_RIGHT) and BtnDown then + begin + //if RightMbESC is set, send ESC keypress + Result:=ParseInput(SDLK_ESCAPE, #0, true); + end; + + nBut := InteractAt(X, Y); + if nBut >= 0 then + begin + //select on mouse-over + if nBut <> Interaction then + SetInteraction(nBut); + if (MouseButton = SDL_BUTTON_LEFT) and BtnDown then + begin + //click button + Result:=ParseInput(SDLK_RETURN, #0, true); + end; + if (Interactions[nBut].Typ = iSelectS) then + begin + //forward/backward in select slide with mousewheel + if (MouseButton = SDL_BUTTON_WHEELDOWN) and BtnDown then + begin + ParseInput(SDLK_RIGHT, #0, true); + end; + if (MouseButton = SDL_BUTTON_WHEELUP) and BtnDown then + begin + ParseInput(SDLK_LEFT, #0, true); + end; + end; + end + else + begin + nBut := CollectionAt(X, Y); + if nBut >= 0 then + begin + // if over button collection, select first child but don't allow click + nBut := ButtonCollection[nBut].FirstChild - 1; + if nBut <> Interaction then + SetInteraction(nBut); + end; + end; +end; + +function TMenu.InRegion(X1, Y1, W, H, X, Y: real): boolean; +begin + Result := false; + X1 := X1 * Screen.w / 800; + W := W * Screen.w / 800; + Y1 := Y1 * Screen.h / 600; + H := H * Screen.h / 600; + if (X >= X1) and (X <= X1 + W) and (Y >= Y1) and (Y <= Y1 + H) then + Result := true; +end; + +//takes x,y coordinates and returns the interaction number +//of the control at this position +function TMenu.InteractAt(X, Y: real): integer; +var + i, nBut: integer; +begin + Result := -1; + for i := Low(Interactions) to High(Interactions) do + begin + case Interactions[i].Typ of + iButton: if InRegion(Button[Interactions[i].Num].X, Button[Interactions[i].Num].Y, Button[Interactions[i].Num].W, Button[Interactions[i].Num].H, X, Y) and + Button[Interactions[i].Num].Visible then + begin + Result:=i; + exit; + end; + iBCollectionChild: if InRegion(Button[Interactions[i].Num].X, Button[Interactions[i].Num].Y, Button[Interactions[i].Num].W, Button[Interactions[i].Num].H, X, Y) then + begin + Result:=i; + exit; + end; + iSelectS: if InRegion(SelectSs[Interactions[i].Num].X, SelectSs[Interactions[i].Num].Y, SelectSs[Interactions[i].Num].W, SelectSs[Interactions[i].Num].H, X, Y) or + InRegion(SelectSs[Interactions[i].Num].TextureSBG.X, SelectSs[Interactions[i].Num].TextureSBG.Y, SelectSs[Interactions[i].Num].TextureSBG.W, SelectSs[Interactions[i].Num].TextureSBG.H, X, Y) then + begin + Result:=i; + exit; + end; + end; + end; +end; + +//takes x,y coordinates and returns the button collection id +function TMenu.CollectionAt(X, Y: real): integer; +var + i, nBut: integer; +begin + Result := -1; + for i:= Low(ButtonCollection) to High(ButtonCollection) do + begin + if InRegion(ButtonCollection[i].X, ButtonCollection[i].Y, ButtonCollection[i].W, ButtonCollection[i].H, X, Y) and + ButtonCollection[i].Visible then + begin + Result:=i; + exit; + end; + end; +end; + procedure TMenu.SetAnimationProgress(Progress: real); begin // nothing end; end. - diff --git a/cmake/src/menu/UMenuButton.pas b/cmake/src/menu/UMenuButton.pas index c6ff8ab7..923f0b14 100644 --- a/cmake/src/menu/UMenuButton.pas +++ b/cmake/src/menu/UMenuButton.pas @@ -55,7 +55,6 @@ type PosX, PosY: real; - constructor Create(); overload; public Text: array of TText; @@ -113,6 +112,7 @@ type procedure Draw; virtual; + constructor Create(); overload; constructor Create(Textura: TTexture); overload; constructor Create(Textura, DSTexture: TTexture); overload; destructor Destroy; override; @@ -252,42 +252,6 @@ begin end; end; -constructor TButton.Create(); -begin - inherited Create; - // We initialize all to 0, nil or false - Visible := true; - SelectBool := false; - DeselectType := 0; - Selectable := true; - Reflection := false; - Colorized := false; - - SelectColR := 1; - SelectColG := 1; - SelectColB := 1; - SelectInt := 1; - SelectTInt := 1; - - DeselectColR := 1; - DeselectColG := 1; - DeselectColB := 1; - DeselectInt := 0.5; - DeselectTInt := 1; - - Fade := false; - FadeTex.TexNum := 0; - FadeProgress := 0; - FadeText := false; - SelectW := DeSelectW; - SelectH := DeSelectH; - - PosX := 0; - PosY := 0; - - Parent := 0; -end; - // ***** Public methods ****** // procedure TButton.Draw; @@ -571,6 +535,42 @@ begin inherited; end; +constructor TButton.Create(); +begin + inherited Create; + // We initialize all to 0, nil or false + Visible := true; + SelectBool := false; + DeselectType := 0; + Selectable := true; + Reflection := false; + Colorized := false; + + SelectColR := 1; + SelectColG := 1; + SelectColB := 1; + SelectInt := 1; + SelectTInt := 1; + + DeselectColR := 1; + DeselectColG := 1; + DeselectColB := 1; + DeselectInt := 0.5; + DeselectTInt := 1; + + Fade := false; + FadeTex.TexNum := 0; + FadeProgress := 0; + FadeText := false; + SelectW := DeSelectW; + SelectH := DeSelectH; + + PosX := 0; + PosY := 0; + + Parent := 0; +end; + constructor TButton.Create(Textura: TTexture); begin Create(); diff --git a/cmake/src/menu/UMenuSelectSlide.pas b/cmake/src/menu/UMenuSelectSlide.pas index a7133492..f9f6bbae 100644 --- a/cmake/src/menu/UMenuSelectSlide.pas +++ b/cmake/src/menu/UMenuSelectSlide.pas @@ -34,10 +34,10 @@ interface {$I switches.inc} uses - TextGL, - UTexture, gl, - UMenuText; + TextGL, + UMenuText, + UTexture; type PSelectSlide = ^TSelectSlide; @@ -54,8 +54,8 @@ type TextureSBG: TTexture; // Background Selections Texture // TextureS: array of TTexture; // Selections Texture (not used) -// TextureArrowL: TTexture; // Texture for left arrow (not used yet) -// TextureArrowR: TTexture; // Texture for right arrow (not used yet) + Tex_SelectS_ArrowL: TTexture; // Texture for left arrow + Tex_SelectS_ArrowR: TTexture; // Texture for right arrow SelectOptInt: integer; PData: ^integer; @@ -63,6 +63,12 @@ type //For automatically Setting LineCount Lines: byte; + //Arrows on/off + showArrows: boolean; //default is false + + //whether to show one item or all that fit into the select + oneItemOnly: boolean; //default is false + //Visibility Visible: boolean; @@ -132,11 +138,12 @@ type end; implementation + uses - UDrawTexture, math, - ULog, - SysUtils; + SysUtils, + UDrawTexture, + ULog; // ------------ Select constructor TSelectSlide.Create; @@ -145,15 +152,7 @@ begin Text := TText.Create; SetLength(TextOpt, 1); TextOpt[0] := TText.Create; - - //Set Standard Width for Selections Background - SBGW := 450; - Visible := true; - {SetLength(TextOpt, 3); - TextOpt[0] := TText.Create; - TextOpt[1] := TText.Create; - TextOpt[2] := TText.Create;} end; procedure TSelectSlide.SetSelect(Value: boolean); @@ -178,14 +177,6 @@ begin TextureSBG.ColG := SBGColG; TextureSBG.ColB := SBGColB; TextureSBG.Int := SBGInt; - -{ for I := 0 to High(TextOpt) do begin - TextOpt[I].ColR := STColR; - TextOpt[I].ColG := STColG; - TextOpt[I].ColB := STColB; - TextOpt[I].Int := STInt; - end;} - end else begin @@ -203,13 +194,6 @@ begin TextureSBG.ColG := SBGDColG; TextureSBG.ColB := SBGDColB; TextureSBG.Int := SBGDInt; - -{ for I := 0 to High(TextOpt) do begin - TextOpt[I].ColR := STDColR; - TextOpt[I].ColG := STDColG; - TextOpt[I].ColB := STDColB; - TextOpt[I].Int := STDInt; - end;} end; end; @@ -219,98 +203,112 @@ var HalfL: integer; HalfR: integer; -procedure DoSelection(Sel: cardinal); + procedure DoSelection(Sel: cardinal); var I: integer; begin - for I := low(TextOpt) to high(TextOpt) do + for I := Low(TextOpt) to High(TextOpt) do begin TextOpt[I].ColR := STDColR; TextOpt[I].ColG := STDColG; TextOpt[I].ColB := STDColB; TextOpt[I].Int := STDInt; end; - if (integer(Sel) <= high(TextOpt)) then + + if (integer(Sel) <= High(TextOpt)) then begin TextOpt[Sel].ColR := STColR; TextOpt[Sel].ColG := STColG; TextOpt[Sel].ColB := STColB; TextOpt[Sel].Int := STInt; + end; end; - end; + begin SelectOptInt := Value; PData^ := Value; -// SetSelect(true); // reset all colors - if (Length(TextOpt)>0) AND (Length(TextOptT)>0) then + if (Length(TextOpt) > 0) and (Length(TextOptT) > 0) then begin + //First option selected if (Value <= 0) then - begin //First Option Selected + begin Value := 0; - for SO := low (TextOpt) to high(TextOpt) do + Tex_SelectS_ArrowL.alpha := 0; + Tex_SelectS_ArrowR.alpha := 1; + + for SO := Low(TextOpt) to High(TextOpt) do begin TextOpt[SO].Text := TextOptT[SO]; end; DoSelection(0); end - else if (Value >= high(TextOptT)) then - begin //Last Option Selected - Value := high(TextOptT); - for SO := high(TextOpt) downto low (TextOpt) do + //Last option selected + else if (Value >= High(TextOptT)) then + begin + Value := High(TextOptT); + + Tex_SelectS_ArrowL.alpha := 1; + Tex_SelectS_ArrowR.alpha := 0; + + for SO := High(TextOpt) downto Low(TextOpt) do begin - TextOpt[SO].Text := TextOptT[high(TextOptT)-(Lines-SO-1)]; + TextOpt[SO].Text := TextOptT[High(TextOptT) - (Lines - SO - 1)]; end; - DoSelection(Lines-1); + DoSelection(Lines - 1); end + + //in between first and last else begin - HalfL := Ceil((Lines-1)/2); - HalfR := Lines-1-HalfL; + Tex_SelectS_ArrowL.alpha := 1; + Tex_SelectS_ArrowR.alpha := 1; + HalfL := Ceil((Lines - 1) / 2); + HalfR := Lines - 1 - HalfL; + + //Selected option is near to the left side if (Value <= HalfL) then - begin //Selected Option is near to the left side - {HalfL := Value; - HalfR := Lines-1-HalfL;} - //Change Texts - for SO := low (TextOpt) to high(TextOpt) do - begin - TextOpt[SO].Text := TextOptT[SO]; - end; - - DoSelection(Value); + begin + //Change texts + for SO := Low(TextOpt) to High(TextOpt) do + begin + TextOpt[SO].Text := TextOptT[SO]; + end; + + DoSelection(Value); end - else if (Value > High(TextOptT)-HalfR) then - begin //Selected is too near to the right border - HalfR := high(TextOptT) - Value; - HalfL := Lines-1-HalfR; - //Change Texts - for SO := high(TextOpt) downto low (TextOpt) do - begin - TextOpt[SO].Text := TextOptT[high(TextOptT)-(Lines-SO-1)]; - end; - - DoSelection (HalfL); + + //Selected option is near to the right side + else if (Value > High(TextOptT) - HalfR) then + begin + HalfR := High(TextOptT) - Value; + HalfL := Lines - 1 - HalfR; + //Change texts + for SO := High(TextOpt) downto Low(TextOpt) do + begin + TextOpt[SO].Text := TextOptT[High(TextOptT) - (Lines - SO - 1)]; + end; + + DoSelection (HalfL); end + else begin - //Change Texts - for SO := low (TextOpt) to high(TextOpt) do - begin + //Change Texts + for SO := Low(TextOpt) to High(TextOpt) do + begin TextOpt[SO].Text := TextOptT[Value - HalfL + SO]; - end; + end; - DoSelection(HalfL); + DoSelection(HalfL); end; - end; - end; - end; procedure TSelectSlide.Draw; @@ -322,9 +320,15 @@ begin DrawTexture(Texture); DrawTexture(TextureSBG); + if showArrows then + begin + DrawTexture(Tex_SelectS_ArrowL); + DrawTexture(Tex_SelectS_ArrowR); + end; + Text.Draw; - for SO := low(TextOpt) to high(TextOpt) do + for SO := Low(TextOpt) to High(TextOpt) do TextOpt[SO].Draw; end; end; @@ -338,26 +342,36 @@ begin SetFontSize(Text.Size); maxlength := 0; - for I := low(TextOptT) to high (TextOptT) do + for I := Low(TextOptT) to High(TextOptT) do begin if (glTextWidth(TextOptT[I]) > maxlength) then maxlength := glTextWidth(TextOptT[I]); end; - Lines := floor((TextureSBG.W-40) / (maxlength+7)); - if (Lines > Length(TextOptT)) then - Lines := Length(TextOptT); - if (Lines <= 0) then + if (oneItemOnly = false) then + begin + //show all items + Lines := floor((TextureSBG.W-40) / (maxlength+7)); + if (Lines > Length(TextOptT)) then + Lines := Length(TextOptT); + + if (Lines <= 0) then + Lines := 1; + end + else + begin + //show one item only Lines := 1; + end; //Free old Space used by Texts - for I := low(TextOpt) to high(TextOpt) do + for I := Low(TextOpt) to High(TextOpt) do TextOpt[I].Free; setLength (TextOpt, Lines); - for I := low(TextOpt) to high(TextOpt) do + for I := Low(TextOpt) to High(TextOpt) do begin TextOpt[I] := TText.Create; TextOpt[I].Size := Text.Size; @@ -372,7 +386,7 @@ begin //Generate Positions //TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W / Lines) * (I + 0.5); - if (I <> High(TextOpt)) OR (High(TextOpt) = 0) OR (Length(TextOptT) = Lines) then + if (I <> High(TextOpt)) or (High(TextOpt) = 0) or (Length(TextOptT) = Lines) then TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W / Lines) * I else TextOpt[I].X := TextureSBG.X + TextureSBG.W - maxlength; @@ -380,8 +394,14 @@ begin TextOpt[I].Y := TextureSBG.Y + (TextureSBG.H - Text.Size) / 2; //Better Look with 2 Options - if (Lines=2) AND (Length(TextOptT)= 2) then + if (Lines = 2) and (Length(TextOptT) = 2) then TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W -40 - glTextWidth(TextOptT[1])) * I; + + if (Lines = 1) then + begin + TextOpt[I].Align := 1; //center text + TextOpt[I].X := TextureSBG.X + (TextureSBG.W / 2); + end; end; end; diff --git a/cmake/src/menu/UMenuText.pas b/cmake/src/menu/UMenuText.pas index 6cf53200..b5507327 100644 --- a/cmake/src/menu/UMenuText.pas +++ b/cmake/src/menu/UMenuText.pas @@ -34,29 +34,29 @@ interface {$I switches.inc} uses - TextGL, - UTexture, - gl, math, SysUtils, - SDL; + gl, + SDL, + TextGL, + UTexture; type TText = class private - SelectBool: boolean; - TextString: string; - TextTiles: array of string; + SelectBool: boolean; + TextString: string; + TextTiles: array of string; - STicks: Cardinal; - SelectBlink: boolean; + STicks: cardinal; + SelectBlink: boolean; public X: real; Y: real; Z: real; - MoveX: real; //Some Modifier for X - Position that don't affect the real Y - MoveY: real; //Some Modifier for Y - Position that don't affect the real Y - W: real; //text wider than W is broken + MoveX: real; // some modifier for x - position that don't affect the real Y + MoveY: real; // some modifier for y - position that don't affect the real Y + W: real; // text wider than W is broken // H: real; Size: real; ColR: real; @@ -64,13 +64,13 @@ type ColB: real; Alpha: real; Int: real; - Style: integer; - Visible: boolean; - Align: integer; // 0 = left, 1 = center, 2 = right + Style: integer; + Visible: boolean; + Align: integer; // 0 = left, 1 = center, 2 = right - //Reflection - Reflection: boolean; - ReflectionSpacing: real; + // reflection + Reflection: boolean; + ReflectionSpacing: real; procedure SetSelect(Value: boolean); property Selected: boolean read SelectBool write SetSelect; @@ -78,7 +78,7 @@ type procedure SetText(Value: string); property Text: string read TextString write SetText; - procedure DeleteLastL; //Procedure to Delete Last Letter + procedure DeleteLastL; // procedure to delete last letter procedure Draw; constructor Create; overload; @@ -88,26 +88,27 @@ type implementation -uses UGraphic, - StrUtils; +uses + StrUtils, + UGraphic; procedure TText.SetSelect(Value: boolean); begin SelectBool := Value; - //Set Cursor Visible - SelectBlink := True; + // set cursor visible + SelectBlink := true; STicks := SDL_GetTicks() div 550; end; procedure TText.SetText(Value: string); var - NextPos: cardinal; // NextPos of a Space etc. - LastPos: cardinal; // LastPos " - LastBreak: cardinal; // Last Break - isBreak: boolean; // True if the Break is not Caused because the Text is out of the area - FirstWord: word; // Is First Word after Break? - Len: word; // Length of the Tiles Array + NextPos: cardinal; // next pos of a space etc. + LastPos: cardinal; // last pos " + LastBreak: cardinal; // last break + isBreak: boolean; // true if the break is not caused because the text is out of the area + FirstWord: word; // is first word after break? + Len: word; // length of the tiles array function GetNextPos: boolean; var @@ -115,16 +116,16 @@ var begin LastPos := NextPos; - //Next Space (If Width is given) + // next space (if width is given) if (W > 0) then T1 := PosEx(' ', Value, LastPos + 1) else T1 := Length(Value); - {//Next - + {// next - T2 := PosEx('-', Value, LastPos + 1);} - //Next Break + // next break T3 := PosEx('\n', Value, LastPos + 1); if T1 = 0 then @@ -134,7 +135,7 @@ var if T3 = 0 then T3 := Length(Value); - //Get Nearest Pos + // get nearest pos NextPos := min(T1, T3{min(T2, T3)}); if (LastPos = cardinal(Length(Value))) then @@ -161,14 +162,14 @@ var end; begin - //Set TExtstring + // set TextString TextString := Value; - //Set Cursor Visible - SelectBlink := True; + // set cursor visible + SelectBlink := true; STicks := SDL_GetTicks() div 550; - //Exit if there is no Need to Create Tiles + // exit if there is no need to create tiles if (W <= 0) and (Pos('\n', Value) = 0) then begin SetLength (TextTiles, 1); @@ -176,12 +177,12 @@ begin Exit; end; - //Create Tiles - //Reset Text Array + // create tiles + // reset text array SetLength (TextTiles, 0); Len := 0; - //Reset Counter Vars + // reset counter vars LastPos := 1; NextPos := 1; LastBreak := 1; @@ -189,57 +190,57 @@ begin if (W > 0) then begin - //Set Font Properties + // set font properties SetFontStyle(Style); SetFontSize(Size); end; - //go Through Text + // go through text while (GetNextPos) do begin - //Break in Text + // break in text if isBreak then begin - //Look for Break before the Break + // look for break before the break if (glTextWidth(Copy(Value, LastBreak, NextPos - LastBreak + 1)) > W) AND (NextPos-LastPos > 1) then begin - isBreak := False; - //Not the First word after Break, so we don't have to break within a word + isBreak := false; + // not the first word after break, so we don't have to break within a word if (FirstWord > 1) then begin - //Add Break before actual Position, because there the Text fits the Area + // add break before actual position, because there the text fits the area AddBreak(LastBreak, LastPos); end - else //First Word after Break Break within the Word + else // first word after break break within the word begin - //ToDo - //AddBreak(LastBreak, LastBreak + 155); + // to do + // AddBreak(LastBreak, LastBreak + 155); end; end; - isBreak := True; - //Add Break from Text + isBreak := true; + // add break from text AddBreak(LastBreak, NextPos); end - //Text comes out of the Text Area -> CreateBreak + // text comes out of the text area -> createbreak else if (glTextWidth(Copy(Value, LastBreak, NextPos - LastBreak + 1)) > W) then begin - //Not the First word after Break, so we don't have to break within a word + // not the first word after break, so we don't have to break within a word if (FirstWord > 1) then begin - //Add Break before actual Position, because there the Text fits the Area + // add break before actual position, because there the text fits the area AddBreak(LastBreak, LastPos); end - else //First Word after Break -> Break within the Word + else // first word after break -> break within the word begin - //ToDo - //AddBreak(LastBreak, LastBreak + 155); + // to do + // AddBreak(LastBreak, LastBreak + 155); end; end; //end; Inc(FirstWord) end; - //Add Ending + // add ending AddBreak(LastBreak, Length(Value)+1); end; @@ -260,34 +261,35 @@ procedure TText.Draw; var X2, Y2: real; Text2: string; - I: cardinal; + I: integer; + Ticks: cardinal; begin if Visible then begin SetFontStyle(Style); SetFontSize(Size); - SetFontItalic(False); + SetFontItalic(false); glColor4f(ColR*Int, ColG*Int, ColB*Int, Alpha); - //Reflection - if Reflection = true then + // reflection + if Reflection then SetFontReflection(true, ReflectionSpacing) else SetFontReflection(false,0); - //if selected set blink... + // if selected set blink... if SelectBool then begin - I := SDL_GetTicks() div 550; - if I <> STicks then - begin //Change Visability - STicks := I; + Ticks := SDL_GetTicks() div 550; + if Ticks <> STicks then + begin // change visability + STicks := Ticks; SelectBlink := Not SelectBlink; end; end; - {if (False) then //no width set draw as one long string + {if (false) then // no width set draw as one long string begin if not (SelectBool AND SelectBlink) then Text2 := Text @@ -306,20 +308,20 @@ begin end else begin} - //now use allways: - //draw text as many strings + // now use always: + // draw text as many strings Y2 := Y + MoveY; - for I := 0 to high(TextTiles) do + for I := 0 to High(TextTiles) do begin - if (not (SelectBool and SelectBlink)) or (I <> cardinal(high(TextTiles))) then + if (not (SelectBool and SelectBlink)) or (I <> High(TextTiles)) then Text2 := TextTiles[I] else Text2 := TextTiles[I] + '|'; case Align of - 0: X2 := X + MoveX; - 1: X2 := X + MoveX - glTextWidth(Text2)/2; - 2: X2 := X + MoveX - glTextWidth(Text2); + 1: X2 := X + MoveX - glTextWidth(Text2)/2; { centered } + 2: X2 := X + MoveX - glTextWidth(Text2); { right aligned } + else X2 := X + MoveX; { left aligned (default) } end; SetFontPos(X2, Y2); @@ -352,7 +354,14 @@ begin Create(X, Y, 0, 0, 30, 0, 0, 0, 0, Text, false, 0, 0); end; -constructor TText.Create(ParX, ParY, ParW: real; ParStyle: integer; ParSize, ParColR, ParColG, ParColB: real; ParAlign: integer; ParText: string; ParReflection: boolean; ParReflectionSpacing: real; ParZ:real); +constructor TText.Create(ParX, ParY, ParW: real; + ParStyle: integer; + ParSize, ParColR, ParColG, ParColB: real; + ParAlign: integer; + ParText: string; + ParReflection: boolean; + ParReflectionSpacing: real; + ParZ: real); begin inherited Create; Alpha := 1; @@ -370,8 +379,8 @@ begin Align := ParAlign; SelectBool := false; Visible := true; - Reflection:= ParReflection; - ReflectionSpacing:= ParReflectionSpacing; + Reflection := ParReflection; + ReflectionSpacing := ParReflectionSpacing; end; end. diff --git a/cmake/src/screens/UScreenEditConvert.pas b/cmake/src/screens/UScreenEditConvert.pas index 361a3be7..e4a691cf 100644 --- a/cmake/src/screens/UScreenEditConvert.pas +++ b/cmake/src/screens/UScreenEditConvert.pas @@ -34,6 +34,7 @@ interface {$I switches.inc} uses + math, UMenu, SDL, {$IFDEF UseMIDIPort} @@ -575,7 +576,7 @@ var Bottom: real; X: real; Y: real; - H: real; + Height: real; YSkip: real; begin // draw static menu @@ -583,20 +584,24 @@ begin Y := 100; - H := Length(ATrack)*40; - if H > 480 then - H := 480; - Bottom := Y + H; + Height := min(480, 40 * Length(ATrack)); + Bottom := Y + Height; - YSkip := H / Length(ATrack); + if Length(ATrack) = 0 then // prevent crash with uncomplete code. + begin + Log.LogDebug ('UScreenEditConvert -> TScreenEditConvert.Draw:', 'Length(ATrack) = 0'); + YSkip := 40; + end + else + YSkip := Height / Length(ATrack); // select - DrawQuad(10, Y+Sel*YSkip, 780, YSkip, 0.8, 0.8, 0.8); + DrawQuad(10, Y + Sel*YSkip, 780, YSkip, 0.8, 0.8, 0.8); // selected - now me use Status System for Count := 0 to High(ATrack) do if ATrack[Count].Hear then - DrawQuad(10, Y+Count*YSkip, 50, YSkip, 0.8, 0.3, 0.3); + DrawQuad(10, Y + Count*YSkip, 50, YSkip, 0.8, 0.3, 0.3); glColor3f(0, 0, 0); for Count := 0 to High(ATrack) do begin @@ -614,12 +619,12 @@ begin end; end; - DrawLine(10, Y, 10, Bottom, 0, 0, 0); - DrawLine(60, Y, 60, Bottom, 0, 0, 0); + DrawLine( 10, Y, 10, Bottom, 0, 0, 0); + DrawLine( 60, Y, 60, Bottom, 0, 0, 0); DrawLine(790, Y, 790, Bottom, 0, 0, 0); for Count := 0 to Length(ATrack) do - DrawLine(10, Y+Count*YSkip, 790, Y+Count*YSkip, 0, 0, 0); + DrawLine(10, Y + Count*YSkip, 790, Y + Count*YSkip, 0, 0, 0); for Count := 0 to High(ATrack) do begin @@ -632,9 +637,21 @@ begin for Count2 := 0 to High(ATrack[Count].Note) do begin if ATrack[Count].Note[Count2].EventType = 9 then - DrawQuad(60 + ATrack[Count].Note[Count2].Start/Len * 725, Y + (Count+1)*YSkip - ATrack[Count].Note[Count2].Data1*35/127, 3, 3, ColR[Count], ColG[Count], ColB[Count]); + DrawQuad(60 + ATrack[Count].Note[Count2].Start/Len*725, + Y + (Count+1)*YSkip - ATrack[Count].Note[Count2].Data1*35/127, + 3, + 3, + ColR[Count], + ColG[Count], + ColB[Count]); if ATrack[Count].Note[Count2].EventType = 15 then - DrawLine(60 + ATrack[Count].Note[Count2].Start/Len * 725, Y + 0.75 * YSkip + Count*YSkip, 60 + ATrack[Count].Note[Count2].Start/Len * 725, Y + YSkip + Count*YSkip, ColR[Count], ColG[Count], ColB[Count]); + DrawLine(60 + ATrack[Count].Note[Count2].Start/Len*725, + Y + 0.75*YSkip + Count*YSkip, + 60 + ATrack[Count].Note[Count2].Start/Len*725, + Y + YSkip + Count*YSkip, + ColR[Count], + ColG[Count], + ColB[Count]); end; // playing line diff --git a/cmake/src/screens/UScreenMain.pas b/cmake/src/screens/UScreenMain.pas index 36cf84b0..a4e6009f 100644 --- a/cmake/src/screens/UScreenMain.pas +++ b/cmake/src/screens/UScreenMain.pas @@ -52,10 +52,7 @@ type function ParseInput(PressedKey: cardinal; CharCode: widechar; PressedDown: boolean): boolean; override; procedure onShow; override; - procedure InteractNext; override; - procedure InteractPrev; override; - procedure InteractInc; override; - procedure InteractDec; override; + procedure SetInteraction(Num: integer); override; procedure SetAnimationProgress(Progress: real); override; end; @@ -238,36 +235,19 @@ end; procedure TScreenMain.onShow; begin inherited; + + { display cursor (on moved) } + Display.SetCursor; + {** * Start background music *} SoundLib.StartBgMusic; end; -procedure TScreenMain.InteractNext; -begin - inherited InteractNext; - Text[TextDescription].Text := Theme.Main.Description[Interaction]; - Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; -end; - -procedure TScreenMain.InteractPrev; -begin - inherited InteractPrev; - Text[TextDescription].Text := Theme.Main.Description[Interaction]; - Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; -end; - -procedure TScreenMain.InteractDec; -begin - inherited InteractDec; - Text[TextDescription].Text := Theme.Main.Description[Interaction]; - Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; -end; - -procedure TScreenMain.InteractInc; +procedure TScreenMain.SetInteraction(Num: integer); begin - inherited InteractInc; + inherited SetInteraction(Num); Text[TextDescription].Text := Theme.Main.Description[Interaction]; Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; end; diff --git a/cmake/src/screens/UScreenOptionsAdvanced.pas b/cmake/src/screens/UScreenOptionsAdvanced.pas index f57ee865..0fb8153c 100644 --- a/cmake/src/screens/UScreenOptionsAdvanced.pas +++ b/cmake/src/screens/UScreenOptionsAdvanced.pas @@ -128,13 +128,30 @@ begin LoadFromTheme(Theme.OptionsAdvanced); //SelectLoadAnimation Hidden because it is useless atm - //AddSelect(Theme.OptionsAdvanced.SelectLoadAnimation, Ini.LoadAnimation, ILoadAnimation); - AddSelectSlide(Theme.OptionsAdvanced.SelectScreenFade, Ini.ScreenFade, IScreenFade); - AddSelectSlide(Theme.OptionsAdvanced.SelectEffectSing, Ini.EffectSing, IEffectSing); - AddSelectSlide(Theme.OptionsAdvanced.SelectLineBonus, Ini.LineBonus, ILineBonus); - AddSelectSlide(Theme.OptionsAdvanced.SelectOnSongClick, Ini.OnSongClick, IOnSongClick); - AddSelectSlide(Theme.OptionsAdvanced.SelectAskbeforeDel, Ini.AskBeforeDel, IAskbeforeDel); - AddSelectSlide(Theme.OptionsAdvanced.SelectPartyPopup, Ini.PartyPopup, IPartyPopup); + //AddSelect(Theme.OptionsAdvanced.SelectLoadAnimation, Ini.LoadAnimation, ILoadAnimationTranslated); + Theme.OptionsAdvanced.SelectScreenFade.showArrows := true; + Theme.OptionsAdvanced.SelectScreenFade.oneItemOnly := true; + AddSelectSlide(Theme.OptionsAdvanced.SelectScreenFade, Ini.ScreenFade, IScreenFadeTranslated); + + Theme.OptionsAdvanced.SelectEffectSing.showArrows := true; + Theme.OptionsAdvanced.SelectEffectSing.oneItemOnly := true; + AddSelectSlide(Theme.OptionsAdvanced.SelectEffectSing, Ini.EffectSing, IEffectSingTranslated); + + Theme.OptionsAdvanced.SelectLineBonus.showArrows := true; + Theme.OptionsAdvanced.SelectLineBonus.oneItemOnly := true; + AddSelectSlide(Theme.OptionsAdvanced.SelectLineBonus, Ini.LineBonus, ILineBonusTranslated); + + Theme.OptionsAdvanced.SelectOnSongClick.showArrows := true; + Theme.OptionsAdvanced.SelectOnSongClick.oneItemOnly := true; + AddSelectSlide(Theme.OptionsAdvanced.SelectOnSongClick, Ini.OnSongClick, IOnSongClickTranslated); + + Theme.OptionsAdvanced.SelectAskbeforeDel.showArrows := true; + Theme.OptionsAdvanced.SelectAskbeforeDel.oneItemOnly := true; + AddSelectSlide(Theme.OptionsAdvanced.SelectAskbeforeDel, Ini.AskBeforeDel, IAskbeforeDelTranslated); + + Theme.OptionsAdvanced.SelectPartyPopup.showArrows := true; + Theme.OptionsAdvanced.SelectPartyPopup.oneItemOnly := true; + AddSelectSlide(Theme.OptionsAdvanced.SelectPartyPopup, Ini.PartyPopup, IPartyPopupTranslated); AddButton(Theme.OptionsAdvanced.ButtonExit); if (Length(Button[0].Text)=0) then diff --git a/cmake/src/screens/UScreenOptionsGame.pas b/cmake/src/screens/UScreenOptionsGame.pas index 3c78363f..1d741d25 100644 --- a/cmake/src/screens/UScreenOptionsGame.pas +++ b/cmake/src/screens/UScreenOptionsGame.pas @@ -34,14 +34,14 @@ interface {$I switches.inc} uses - UMenu, SDL, UDisplay, - UMusic, UFiles, UIni, - UThemes, - USongs; + UMenu, + UMusic, + USongs, + UThemes; type TScreenOptionsGame = class(TMenu) @@ -56,13 +56,15 @@ type implementation uses - UGraphic, - SysUtils; + SysUtils, + UGraphic; -function TScreenOptionsGame.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; +function TScreenOptionsGame.ParseInput(PressedKey: cardinal; + CharCode: WideChar; + PressedDown: boolean): boolean; begin Result := true; - if (PressedDown) then + if PressedDown then begin // Key Down // check normal keys case WideCharUpperCase(CharCode)[1] of @@ -80,7 +82,6 @@ begin begin AudioPlayback.PlaySound(SoundLib.Back); RefreshSongs; - FadeTo(@ScreenOptions); end; SDLK_RETURN: @@ -126,15 +127,34 @@ begin old_Sorting := Ini.Sorting; old_Tabs := Ini.Tabs; + Theme.OptionsGame.SelectPlayers.showArrows := true; + Theme.OptionsGame.SelectPlayers.oneItemOnly := true; AddSelectSlide(Theme.OptionsGame.SelectPlayers, Ini.Players, IPlayers); - AddSelectSlide(Theme.OptionsGame.SelectDifficulty, Ini.Difficulty, IDifficulty); + + Theme.OptionsGame.SelectDifficulty.showArrows := true; + Theme.OptionsGame.SelectDifficulty.oneItemOnly := true; + AddSelectSlide(Theme.OptionsGame.SelectDifficulty, Ini.Difficulty, IDifficultyTranslated); + + Theme.OptionsGame.SelectLanguage.showArrows := true; + Theme.OptionsGame.SelectLanguage.oneItemOnly := true; AddSelectSlide(Theme.OptionsGame.SelectLanguage, Ini.Language, ILanguage); - AddSelectSlide(Theme.OptionsGame.SelectTabs, Ini.Tabs, ITabs); - AddSelectSlide(Theme.OptionsGame.SelectSorting, Ini.Sorting, ISorting); - AddSelectSlide(Theme.OptionsGame.SelectDebug, Ini.Debug, IDebug); + + Theme.OptionsGame.SelectTabs.showArrows := true; + Theme.OptionsGame.SelectTabs.oneItemOnly := true; + AddSelectSlide(Theme.OptionsGame.SelectTabs, Ini.Tabs, ITabsTranslated); + + Theme.OptionsGame.SelectSorting.showArrows := true; + Theme.OptionsGame.SelectSorting.oneItemOnly := true; + AddSelectSlide(Theme.OptionsGame.SelectSorting, Ini.Sorting, ISortingTranslated); + + Theme.OptionsGame.SelectDebug.showArrows := true; + Theme.OptionsGame.SelectDebug.oneItemOnly := true; + AddSelectSlide(Theme.OptionsGame.SelectDebug, Ini.Debug, IDebugTranslated); + + AddButton(Theme.OptionsGame.ButtonExit); - if (Length(Button[0].Text)=0) then + if (Length(Button[0].Text) = 0) then AddButtonText(14, 20, Theme.Options.Description[7]); end; @@ -142,7 +162,7 @@ end; //Refresh Songs Patch procedure TScreenOptionsGame.RefreshSongs; begin -if (ini.Sorting <> old_Sorting) or (ini.Tabs <> old_Tabs) then + if (ini.Sorting <> old_Sorting) or (ini.Tabs <> old_Tabs) then ScreenSong.Refresh; end; diff --git a/cmake/src/screens/UScreenOptionsGraphics.pas b/cmake/src/screens/UScreenOptionsGraphics.pas index 896f3d99..ba1465b2 100644 --- a/cmake/src/screens/UScreenOptionsGraphics.pas +++ b/cmake/src/screens/UScreenOptionsGraphics.pas @@ -132,12 +132,29 @@ begin inherited Create; LoadFromTheme(Theme.OptionsGraphics); + Theme.OptionsGraphics.SelectResolution.showArrows := true; + Theme.OptionsGraphics.SelectResolution.oneItemOnly := true; AddSelectSlide(Theme.OptionsGraphics.SelectResolution, Ini.Resolution, IResolution); - AddSelectSlide(Theme.OptionsGraphics.SelectFullscreen, Ini.Fullscreen, IFullscreen); + + Theme.OptionsGraphics.SelectFullscreen.showArrows := true; + Theme.OptionsGraphics.SelectFullscreen.oneItemOnly := true; + AddSelectSlide(Theme.OptionsGraphics.SelectFullscreen, Ini.Fullscreen, IFullScreenTranslated); + + Theme.OptionsGraphics.SelectDepth.showArrows := true; + Theme.OptionsGraphics.SelectDepth.oneItemOnly := true; AddSelectSlide(Theme.OptionsGraphics.SelectDepth, Ini.Depth, IDepth); - AddSelectSlide(Theme.OptionsGraphics.SelectVisualizer, Ini.VisualizerOption, IVisualizer); - AddSelectSlide(Theme.OptionsGraphics.SelectOscilloscope, Ini.Oscilloscope, IOscilloscope); - AddSelectSlide(Theme.OptionsGraphics.SelectMovieSize, Ini.MovieSize, IMovieSize); + + Theme.OptionsGraphics.SelectVisualizer.showArrows := true; + Theme.OptionsGraphics.SelectVisualizer.oneItemOnly := true; + AddSelectSlide(Theme.OptionsGraphics.SelectVisualizer, Ini.VisualizerOption, IVisualizerTranslated); + + Theme.OptionsGraphics.SelectOscilloscope.showArrows := true; + Theme.OptionsGraphics.SelectOscilloscope.oneItemOnly := true; + AddSelectSlide(Theme.OptionsGraphics.SelectOscilloscope, Ini.Oscilloscope, IOscilloscopeTranslated); + + Theme.OptionsGraphics.SelectMovieSize.showArrows := true; + Theme.OptionsGraphics.SelectMovieSize.oneItemOnly := true; + AddSelectSlide(Theme.OptionsGraphics.SelectMovieSize, Ini.MovieSize, IMovieSizeTranslated); AddButton(Theme.OptionsGraphics.ButtonExit); if (Length(Button[0].Text)=0) then diff --git a/cmake/src/screens/UScreenOptionsLyrics.pas b/cmake/src/screens/UScreenOptionsLyrics.pas index 7efe1cd2..035b0089 100644 --- a/cmake/src/screens/UScreenOptionsLyrics.pas +++ b/cmake/src/screens/UScreenOptionsLyrics.pas @@ -119,10 +119,17 @@ begin LoadFromTheme(Theme.OptionsLyrics); - AddSelectSlide(Theme.OptionsLyrics.SelectLyricsFont, Ini.LyricsFont, ILyricsFont); - AddSelectSlide(Theme.OptionsLyrics.SelectLyricsEffect, Ini.LyricsEffect, ILyricsEffect); - //AddSelect(Theme.OptionsLyrics.SelectSolmization, Ini.Solmization, ISolmization); GAH!!!!11 DIE!!! - AddSelectSlide(Theme.OptionsLyrics.SelectNoteLines, Ini.NoteLines, INoteLines); + Theme.OptionsLyrics.SelectLyricsFont.showArrows := true; + Theme.OptionsLyrics.SelectLyricsFont.oneItemOnly := true; + AddSelectSlide(Theme.OptionsLyrics.SelectLyricsFont, Ini.LyricsFont, ILyricsFontTranslated); + + Theme.OptionsLyrics.SelectLyricsEffect.showArrows := true; + Theme.OptionsLyrics.SelectLyricsEffect.oneItemOnly := true; + AddSelectSlide(Theme.OptionsLyrics.SelectLyricsEffect, Ini.LyricsEffect, ILyricsEffectTranslated); + + Theme.OptionsLyrics.SelectNoteLines.showArrows := true; + Theme.OptionsLyrics.SelectNoteLines.oneItemOnly := true; + AddSelectSlide(Theme.OptionsLyrics.SelectNoteLines, Ini.NoteLines, INoteLinesTranslated); AddButton(Theme.OptionsLyrics.ButtonExit); if (Length(Button[0].Text)=0) then diff --git a/cmake/src/screens/UScreenOptionsRecord.pas b/cmake/src/screens/UScreenOptionsRecord.pas index 3737a134..cf799204 100644 --- a/cmake/src/screens/UScreenOptionsRecord.pas +++ b/cmake/src/screens/UScreenOptionsRecord.pas @@ -244,6 +244,8 @@ begin InputDeviceNames[DeviceIndex] := AudioInputProcessor.DeviceList[DeviceIndex].Name; end; // add device-selection slider (InteractionID: 0) + Theme.OptionsRecord.SelectSlideCard.showArrows := true; + Theme.OptionsRecord.SelectSlideCard.oneItemOnly := true; AddSelectSlide(Theme.OptionsRecord.SelectSlideCard, CurrentDeviceIndex, InputDeviceNames); // init source-selection slider @@ -252,6 +254,9 @@ begin begin InputSourceNames[SourceIndex] := InputDevice.Source[SourceIndex].Name; end; + + Theme.OptionsRecord.SelectSlideInput.showArrows := true; + Theme.OptionsRecord.SelectSlideInput.oneItemOnly := true; // add source-selection slider (InteractionID: 1) SelectInputSourceID := AddSelectSlide(Theme.OptionsRecord.SelectSlideInput, InputDeviceCfg.Input, InputSourceNames); diff --git a/cmake/src/screens/UScreenOptionsSound.pas b/cmake/src/screens/UScreenOptionsSound.pas index 99ecb599..aa87ceb4 100644 --- a/cmake/src/screens/UScreenOptionsSound.pas +++ b/cmake/src/screens/UScreenOptionsSound.pas @@ -136,19 +136,39 @@ begin LoadFromTheme(Theme.OptionsSound); - AddSelectSlide(Theme.OptionsSound.SelectSlideVoicePassthrough, - Ini.VoicePassthrough, IVoicePassthrough); - AddSelectSlide(Theme.OptionsSound.SelectBackgroundMusic, - Ini.BackgroundMusicOption, IBackgroundMusic); - AddSelectSlide(Theme.OptionsSound.SelectMicBoost, Ini.MicBoost, IMicBoost); + Theme.OptionsSound.SelectSlideVoicePassthrough.showArrows := true; + Theme.OptionsSound.SelectSlideVoicePassthrough.oneItemOnly := true; + AddSelectSlide(Theme.OptionsSound.SelectSlideVoicePassthrough, Ini.VoicePassthrough, IVoicePassthroughTranslated); + + Theme.OptionsSound.SelectBackgroundMusic.showArrows := true; + Theme.OptionsSound.SelectBackgroundMusic.oneItemOnly := true; + AddSelectSlide(Theme.OptionsSound.SelectBackgroundMusic, Ini.BackgroundMusicOption, IBackgroundMusicTranslated); + // TODO: - MicBoost needs to be moved to ScreenOptionsRecord - AddSelectSlide(Theme.OptionsSound.SelectClickAssist, Ini.ClickAssist, IClickAssist); - AddSelectSlide(Theme.OptionsSound.SelectBeatClick, Ini.BeatClick, IBeatClick); + Theme.OptionsSound.SelectMicBoost.showArrows := true; + Theme.OptionsSound.SelectMicBoost.oneItemOnly := true; + AddSelectSlide(Theme.OptionsSound.SelectMicBoost, Ini.MicBoost, IMicBoostTranslated); + + + Theme.OptionsSound.SelectClickAssist.showArrows := true; + Theme.OptionsSound.SelectClickAssist.oneItemOnly := true; + AddSelectSlide(Theme.OptionsSound.SelectClickAssist, Ini.ClickAssist, IClickAssistTranslated); + + Theme.OptionsSound.SelectBeatClick.showArrows := true; + Theme.OptionsSound.SelectBeatClick.oneItemOnly := true; + AddSelectSlide(Theme.OptionsSound.SelectBeatClick, Ini.BeatClick, IBeatClickTranslated); + + Theme.OptionsSound.SelectThreshold.showArrows := true; + Theme.OptionsSound.SelectThreshold.oneItemOnly := true; AddSelectSlide(Theme.OptionsSound.SelectThreshold, Ini.ThresholdIndex, IThreshold); - AddSelectSlide(Theme.OptionsSound.SelectSlidePreviewVolume, - Ini.PreviewVolume, IPreviewVolume); - AddSelectSlide(Theme.OptionsSound.SelectSlidePreviewFading, - Ini.PreviewFading, IPreviewFading); + + Theme.OptionsSound.SelectSlidePreviewVolume.showArrows := true; + Theme.OptionsSound.SelectSlidePreviewVolume.oneItemOnly := true; + AddSelectSlide(Theme.OptionsSound.SelectSlidePreviewVolume, Ini.PreviewVolume, IPreviewVolumeTranslated); + + Theme.OptionsSound.SelectSlidePreviewFading.showArrows := true; + Theme.OptionsSound.SelectSlidePreviewFading.oneItemOnly := true; + AddSelectSlide(Theme.OptionsSound.SelectSlidePreviewFading, Ini.PreviewFading, IPreviewFadingTranslated); AddButton(Theme.OptionsSound.ButtonExit); if (Length(Button[0].Text) = 0) then diff --git a/cmake/src/screens/UScreenOptionsThemes.pas b/cmake/src/screens/UScreenOptionsThemes.pas index e44bfca8..1e7407f1 100644 --- a/cmake/src/screens/UScreenOptionsThemes.pas +++ b/cmake/src/screens/UScreenOptionsThemes.pas @@ -161,11 +161,17 @@ begin LoadFromTheme(Theme.OptionsThemes); + Theme.OptionsThemes.SelectTheme.showArrows := true; + Theme.OptionsThemes.SelectTheme.oneItemOnly := true; AddSelectSlide(Theme.OptionsThemes.SelectTheme, Ini.Theme, ITheme); + Theme.OptionsThemes.SelectSkin.showArrows := true; + Theme.OptionsThemes.SelectSkin.oneItemOnly := true; SkinSelect := AddSelectSlide(Theme.OptionsThemes.SelectSkin, Ini.SkinNo, ISkin); - AddSelectSlide(Theme.OptionsThemes.SelectColor, Ini.Color, IColor); + Theme.OptionsThemes.SelectColor.showArrows := true; + Theme.OptionsThemes.SelectColor.oneItemOnly := true; + AddSelectSlide(Theme.OptionsThemes.SelectColor, Ini.Color, IColorTranslated); AddButton(Theme.OptionsThemes.ButtonExit); if (Length(Button[0].Text)=0) then diff --git a/cmake/src/screens/UScreenScore.pas b/cmake/src/screens/UScreenScore.pas index f3f888b3..a01c7691 100644 --- a/cmake/src/screens/UScreenScore.pas +++ b/cmake/src/screens/UScreenScore.pas @@ -129,6 +129,7 @@ type constructor Create; override; function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; + function ParseMouse(MouseButton: Integer; BtnDown: Boolean; X, Y: integer): boolean; override; procedure onShow; override; procedure onShowFinish; override; function Draw: boolean; override; @@ -191,6 +192,15 @@ begin end; end; +function TScreenScore.ParseMouse(MouseButton: Integer; BtnDown: Boolean; X, Y: integer): boolean; +begin + Result := True; + if (MouseButton = SDL_BUTTON_LEFT) and BtnDown then begin + //left-click anywhere sends return + ParseInput(SDLK_RETURN, #0, true); + end; +end; + constructor TScreenScore.Create; var Player: integer; diff --git a/cmake/src/screens/UScreenSing.pas b/cmake/src/screens/UScreenSing.pas index c29c0e2c..ae75c74d 100644 --- a/cmake/src/screens/UScreenSing.pas +++ b/cmake/src/screens/UScreenSing.pas @@ -126,7 +126,8 @@ uses ULanguage, UNote, URecord, - USong; + USong, + UDisplay; // method for input parsing. if false is returned, getnextwindow // should be checked to know the next window to load; @@ -253,6 +254,9 @@ constructor TScreenSing.Create; begin inherited Create; + //too dangerous, a mouse button is quickly pressed by accident + RightMbESC := false; + fShowVisualization := false; fCurrentVideoPlaybackEngine := VideoPlayback; @@ -297,8 +301,8 @@ begin Static[StaticPausePopup].Visible := false; Lyrics := TLyricEngine.Create( - Skin_LyricsUpperX, Skin_LyricsUpperY, Skin_LyricsUpperW, Skin_LyricsUpperH, - Skin_LyricsLowerX, Skin_LyricsLowerY, Skin_LyricsLowerW, Skin_LyricsLowerH); + Theme.LyricBar.UpperX, Theme.LyricBar.UpperY, Theme.LyricBar.UpperW, Theme.LyricBar.UpperH, + Theme.LyricBar.LowerX, Theme.LyricBar.LowerY, Theme.LyricBar.LowerW, Theme.LyricBar.LowerH); LyricsSync := TLyricsSyncSource.Create(); end; @@ -623,6 +627,9 @@ end; procedure TScreenSing.onShowFinish; begin + // hide cursor on singscreen show + Display.SetCursor; + // start lyrics LyricsState.Resume(); @@ -643,6 +650,7 @@ begin end; Background.OnFinish; + Display.SetCursor; end; function TScreenSing.Draw: boolean; diff --git a/cmake/src/screens/UScreenSong.pas b/cmake/src/screens/UScreenSong.pas index 8f4dd5da..fa3c836e 100644 --- a/cmake/src/screens/UScreenSong.pas +++ b/cmake/src/screens/UScreenSong.pas @@ -34,22 +34,22 @@ interface {$I switches.inc} uses - UMenu, - SDL, - UMusic, - UFiles, - UTime, - UDisplay, - USongs, SysUtils, + SDL, UCommon, - ULog, - UThemes, - UTexture, + UDisplay, + UFiles, + UIni, ULanguage, + ULog, + UMenu, + UMenuEqualizer, + UMusic, USong, - UIni, - UMenuEqualizer; + USongs, + UTexture, + UThemes, + UTime; type TScreenSong = class(TMenu) @@ -119,6 +119,7 @@ type procedure SetScroll5; procedure SetScroll6; function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; + function ParseMouse(MouseButton: integer; BtnDown: boolean; X, Y: integer): boolean; override; function Draw: boolean; override; procedure GenerateThumbnails(); procedure onShow; override; @@ -175,7 +176,7 @@ begin if CatSongs.VisibleSongs > 0 then begin I2:= 0; - for I := low(CatSongs.Song) to High(Catsongs.Song) do + for I := Low(CatSongs.Song) to High(Catsongs.Song) do begin if CatSongs.Song[I].Visible then inc(I2); @@ -196,7 +197,7 @@ begin if CatSongs.VisibleSongs > 0 then begin I2:= 0; - for I := low(CatSongs.Song) to High(Catsongs.Song) do + for I := Low(CatSongs.Song) to High(Catsongs.Song) do begin if CatSongs.Song[I].Visible then inc(I2); @@ -280,7 +281,7 @@ begin //Jump To Titel if (SDL_ModState = (KMOD_LALT or KMOD_LSHIFT)) then begin - for I := 1 to high(CatSongs.Song) do + for I := 1 to High(CatSongs.Song) do begin if (CatSongs.Song[(I + Interaction) mod I2].Visible) and (Length(CatSongs.Song[(I + Interaction) mod I2].Title)>0) and @@ -300,7 +301,7 @@ begin //Jump to Artist else if (SDL_ModState = KMOD_LALT) then begin - for I := 1 to high(CatSongs.Song) do + for I := 1 to High(CatSongs.Song) do begin if (CatSongs.Song[(I + Interaction) mod I2].Visible) and (Length(CatSongs.Song[(I + Interaction) mod I2].Artist)>0) and @@ -395,25 +396,25 @@ begin if (Songs.SongList.Count > 0) and (Mode = smNormal) then begin - if (SDL_ModState = KMOD_LSHIFT) and (Ini.TabsAtStartup = 1) then //Random Category + if (SDL_ModState = KMOD_LSHIFT) and (Ini.TabsAtStartup = 1) then // random category begin - I2 := 0; //Count Cats - for I:= 0 to high(CatSongs.Song) do + I2 := 0; // count cats + for I := 0 to High(CatSongs.Song) do begin if CatSongs.Song[I].Main then Inc(I2); end; - I2 := Random(I2)+1; //Zufall + I2 := Random(I2 + 1); // random and include I2 - //Find Cat: - for I:= 0 to high(CatSongs.Song) do + // find cat: + for I := 0 to High(CatSongs.Song) do begin if CatSongs.Song[I].Main then Dec(I2); - if (I2<=0) then + if (I2 <= 0) then begin - //Show Cat in Top Left Mod + // show cat in top left mod ShowCatTL (I); Interaction := I; @@ -426,38 +427,38 @@ begin end; end; end - else if (SDL_ModState = KMOD_LCTRL) and (Ini.TabsAtStartup = 1) then //random in All Categorys + else if (SDL_ModState = KMOD_LCTRL) and (Ini.TabsAtStartup = 1) then // random in all categories begin repeat - I2 := Random(high(CatSongs.Song)+1) + 1; + I2 := Random(High(CatSongs.Song) + 1); until (not CatSongs.Song[I2].Main); - //Search Cat + // search cat for I := I2 downto 0 do begin if CatSongs.Song[I].Main then break; end; - //In I is now the categorie in I2 the song + // in I is now the categorie in I2 the song - //Choose Cat + // choose cat CatSongs.ShowCategoryList; - //Show Cat in Top Left Mod + // show cat in top left mod ShowCatTL (I); CatSongs.ClickCategoryButton(I); SelectNext; - //Fix: Not Existing Song selected: - //if (I+1=I2) then + // Fix: not existing song selected: + //if (I + 1 = I2) then Inc(I2); - //Choose Song - SkipTo(I2-I); + // choose song + SkipTo(I2 - I); end - else //Random in one Category + else // random in one category begin SkipTo(Random(CatSongs.VisibleSongs)); end; @@ -489,7 +490,7 @@ begin break; end; if (I <= 1) then - Interaction := high(CatSongs.Song) + Interaction := High(CatSongs.Song) else Interaction := I - 1; @@ -611,8 +612,8 @@ begin while not catsongs.Song[I].Main do begin Inc (I); - if (I > high(catsongs.Song)) then - I := low(catsongs.Song); + if (I > High(catsongs.Song)) then + I := Low(catsongs.Song); end; Interaction := I; @@ -655,8 +656,8 @@ begin if catsongs.Song[I].Main then Inc(I2); Dec (I); - if (I < low(catsongs.Song)) then - I := high(catsongs.Song); + if (I < Low(catsongs.Song)) then + I := High(catsongs.Song); end; Interaction := I; @@ -737,6 +738,26 @@ begin end; // if (PressedDown) end; +function TScreenSong.ParseMouse(MouseButton: integer; BtnDown: boolean; X, Y: integer): boolean; +begin + Result := true; + + if RightMbESC and (MouseButton = SDL_BUTTON_RIGHT) and BtnDown then + //if RightMbESC is set, send ESC keypress + Result:=ParseInput(SDLK_ESCAPE, #0, true); + + //song scrolling with mousewheel + if (MouseButton = SDL_BUTTON_WHEELDOWN) and BtnDown then + ParseInput(SDLK_RIGHT, #0, true); + + if (MouseButton = SDL_BUTTON_WHEELUP) and BtnDown then + ParseInput(SDLK_LEFT, #0, true); + + //LMB anywhere starts + if (MouseButton = SDL_BUTTON_LEFT) and BtnDown then + ParseInput(SDLK_RETURN, #0, true); +end; + constructor TScreenSong.Create; var i: integer; @@ -1312,7 +1333,7 @@ begin else begin //Change Pos of all Buttons - for B := low(Button) to high(Button) do + for B := Low(Button) to High(Button) do begin Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visibility if Button[B].Visible then //Only Change Pos for Visible Buttons @@ -1701,41 +1722,40 @@ var I, I2: integer; begin case PlaylistMan.Mode of - smNormal: //All Songs Just Select Random Song + smNormal: // all songs just select random song begin - //When Tabs are activated then use Tab Method + // when tabs are activated then use tab method if (Ini.TabsAtStartup = 1) then begin repeat - I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; + I2 := Low(CatSongs.Song) + Random(High(CatSongs.Song) + 1 - Low(CatSongs.Song)); until CatSongs.Song[I2].Main = false; - //Search Cat - for I := I2 downto low(CatSongs.Song) do + // search cat + for I := I2 downto Low(CatSongs.Song) do begin if CatSongs.Song[I].Main then break; end; - //In I ist jetzt die Kategorie in I2 der Song - //I is the CatNum, I2 is the No of the Song within this Cat + // I is the cat number, I2 is the no of the song within this cat - //Choose Cat + // choose cat CatSongs.ShowCategoryList; - //Show Cat in Top Left Mod - ShowCatTL (I); + // show cat in top left mod + ShowCatTL(I); CatSongs.ClickCategoryButton(I); SelectNext; - //Choose Song - SkipTo(I2-I); + // choose song + SkipTo(I2 - I); end - //When Tabs are deactivated use easy Method + // when tabs are deactivated use easy method else SkipTo(Random(CatSongs.VisibleSongs)); end; - smPartyMode: //One Category Select Category and Select Random Song + smPartyMode: // one category select category and select random song begin CatSongs.ShowCategoryList; CatSongs.ClickCategoryButton(PlaylistMan.CurPlayList); @@ -1746,7 +1766,7 @@ begin SkipTo(Random(CatSongs.VisibleSongs)); end; - smPlaylistRandom: //Playlist: Select Playlist and Select Random Song + smPlaylistRandom: // playlist: select playlist and select random song begin PlaylistMan.SetPlayList(PlaylistMan.CurPlayList); @@ -1846,19 +1866,19 @@ begin //Set Visibility of Party Statics and Text Visible := (Mode = smPartyMode); - for I := 0 to high(StaticParty) do + for I := 0 to High(StaticParty) do Static[StaticParty[I]].Visible := Visible; - for I := 0 to high(TextParty) do + for I := 0 to High(TextParty) do Text[TextParty[I]].Visible := Visible; //Set Visibility of Non Party Statics and Text Visible := not Visible; - for I := 0 to high(StaticNonParty) do + for I := 0 to High(StaticNonParty) do Static[StaticNonParty[I]].Visible := Visible; - for I := 0 to high(TextNonParty) do + for I := 0 to High(TextNonParty) do Text[TextNonParty[I]].Visible := Visible; end; diff --git a/cmake/src/screens/UScreenTop5.pas b/cmake/src/screens/UScreenTop5.pas index 23405ebb..1013a9b5 100644 --- a/cmake/src/screens/UScreenTop5.pas +++ b/cmake/src/screens/UScreenTop5.pas @@ -57,6 +57,7 @@ type constructor Create; override; function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; + function ParseMouse(MouseButton: integer; BtnDown: boolean; X, Y: integer): boolean; override; procedure onShow; override; function Draw: boolean; override; end; @@ -69,10 +70,12 @@ uses UIni, UNote; -function TScreenTop5.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; +function TScreenTop5.ParseInput(PressedKey: cardinal; + CharCode: WideChar; + PressedDown: boolean): boolean; begin Result := true; - if (PressedDown) then + if PressedDown then begin // check normal keys case WideCharUpperCase(CharCode)[1] of @@ -103,6 +106,16 @@ begin end; end; +function TScreenTop5.ParseMouse(MouseButton: integer; + BtnDown: boolean; + X, Y: integer): boolean; +begin + Result := true; + if (MouseButton = SDL_BUTTON_LEFT) and BtnDown then + //left-click anywhere sends return + ParseInput(SDLK_RETURN, #0, true); +end; + constructor TScreenTop5.Create; var I: integer; @@ -111,18 +124,16 @@ begin LoadFromTheme(Theme.Top5); - TextLevel := AddText(Theme.Top5.TextLevel); + TextLevel := AddText(Theme.Top5.TextLevel); TextArtistTitle := AddText(Theme.Top5.TextArtistTitle); for I := 0 to 4 do - StaticNumber[I+1] := AddStatic( Theme.Top5.StaticNumber[I] ); - - for I := 0 to 4 do - TextNumber[I+1] := AddText(Theme.Top5.TextNumber[I]); - for I := 0 to 4 do - TextName[I+1] := AddText(Theme.Top5.TextName[I]); - for I := 0 to 4 do - TextScore[I+1] := AddText(Theme.Top5.TextScore[I]); + begin + StaticNumber[I+1] := AddStatic(Theme.Top5.StaticNumber[I]); + TextNumber[I+1] := AddText (Theme.Top5.TextNumber[I]); + TextName[I+1] := AddText (Theme.Top5.TextName[I]); + TextScore[I+1] := AddText (Theme.Top5.TextScore[I]); + end; end; @@ -159,7 +170,7 @@ begin Text[TextScore[I]].Text := IntToStr(CurrentSong.Score[Ini.Difficulty, I-1].Score); end; - for I := Length(CurrentSong.Score[Ini.Difficulty])+1 to 5 do + for I := Length(CurrentSong.Score[Ini.Difficulty]) + 1 to 5 do begin Static[StaticNumber[I]].Visible := false; Text[TextNumber[I]].Visible := false; diff --git a/cmake/src/ultrastardx.dpr b/cmake/src/ultrastardx.dpr index fb07d66a..11796cfa 100644 --- a/cmake/src/ultrastardx.dpr +++ b/cmake/src/ultrastardx.dpr @@ -200,6 +200,7 @@ uses USingNotes in 'base\USingNotes.pas', UPath in 'base\UPath.pas', UNote in 'base\UNote.pas', + UBeatTimer in 'base\UBeatTimer.pas', //------------------------------ //Includes - Plugin Support diff --git a/cmake/test/test001.pas b/cmake/test/test001.pas new file mode 100644 index 00000000..c9ba266f --- /dev/null +++ b/cmake/test/test001.pas @@ -0,0 +1,86 @@ +program test001; + +{ +This program tests the function glext_ExtensionSupported from unit glext. +} + +uses + SysUtils, + SDL in '../src/lib/JEDI-SDL/SDL/Pas/sdl.pas', + moduleloader in '../src/lib/JEDI-SDL/SDL/Pas/moduleloader.pas', + gl in '../src/lib/JEDI-SDL/OpenGL/Pas/gl.pas', + glext in '../src/lib/JEDI-SDL/OpenGL/Pas/glext.pas'; + +const + s1: pchar = ''; + s2: pchar = 'ext'; + s3: pchar = ' ext'; + s4: pchar = ' ext '; + s5: pchar = 'kkshf kjsfh ext'; + s6: pchar = 'fakh sajhf ext jskdhf'; + s7: pchar = 'ext jshf'; + s8: pchar = 'sdkjfh ksjhext sjdha'; + s9: pchar = 'sdkjfh ksjh extsjdha'; + s10: pchar = 'sdkjfh ksjhextsjdha'; + s11: pchar = 'sd kjf jdha'; + + e1: pchar = ''; + e2: pchar = 'ext'; + e3: pchar = 'GL_ARB_window_pos'; + + SCREEN_WIDTH = 640; + SCREEN_HEIGHT = 480; + SCREEN_BPP = 16; + +var + surface: PSDL_Surface; + videoFlags: integer; + testFailed: boolean; + +procedure treatTestFailure(testNumber: integer, var testFailed: boolean); +begin + writeln; + write ('test001, ', testNumber, ': failed'); + testFailed := true; +end; + +begin + write ('test001: Start ... '); + testFailed := false; + +// initialize SDL and OpenGL for the use of glGetString(GL_EXTENSIONS) +// within glext_ExtensionSupported. + + SDL_Init( SDL_INIT_VIDEO); + +// the flags to pass to SDL_SetVideoMode + videoFlags := SDL_OPENGL; + +// get a SDL surface + surface := SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, videoFlags); + +// Initialization finished + + if glext_ExtensionSupported(e1, s1) then treatTestFailure( 1, testFailed); + if glext_ExtensionSupported(e1, s2) then treatTestFailure( 2, testFailed); + if glext_ExtensionSupported(e2, s1) then treatTestFailure( 3, testFailed); + if not glext_ExtensionSupported(e2, s2) then treatTestFailure( 4, testFailed); + if not glext_ExtensionSupported(e2, s3) then treatTestFailure( 5, testFailed); + if not glext_ExtensionSupported(e2, s4) then treatTestFailure( 6, testFailed); + if not glext_ExtensionSupported(e2, s5) then treatTestFailure( 7, testFailed); + if not glext_ExtensionSupported(e2, s6) then treatTestFailure( 8, testFailed); + if not glext_ExtensionSupported(e2, s7) then treatTestFailure( 9, testFailed); + if glext_ExtensionSupported(e2, s8) then treatTestFailure(10, testFailed); + if glext_ExtensionSupported(e2, s9) then treatTestFailure(11, testFailed); + if glext_ExtensionSupported(e2, s10) then treatTestFailure(12, testFailed); + if glext_ExtensionSupported(e2, s11) then treatTestFailure(13, testFailed); + if not glext_ExtensionSupported(e3, s1) then treatTestFailure(14, testFailed); + + if testFailed then + begin + writeln; + writeln ('test001: End'); + end + else + writeln ('End'); +end. \ No newline at end of file -- cgit v1.2.3