發表文章

Windows cmd筆記 主要是AppVeyor

https://ss64.com/nt/cmd.html http://steve-jansen.github.io/guides/windows-batch-scripting/part-2-variables.html 變數要看 for /? use in kvirc .appveyor.yml 把變數前三個字元跳過     - '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars%ssl_arch:~3%.bat"'   - if exist VCdeps.7z (curl -kLo VCdeps.7z https://ci.appveyor.com/api/projects/craftwar_appveyor/obs-deps/artifacts/VCdeps.7z -f --retry 5 -z VCdeps.7z) else (curl -kLo VCdeps.7z https://ci.appveyor.com/api/projects/craftwar_appveyor/obs-deps/artifacts/VCdeps.7z -f --retry 5 -C -) output stderr to file dir > a.txt 2>&1 AppVeyor的各種修正 記錄用,也許能學到一些有用的指令 .sh extension is not properly mapped on VS 2017 image  https://github.com/appveyor/ci/issues/1881 cmd / c ftype sh_auto_file = "C:\msys64\usr\bin\bash.exe" " `" %L `" " % * | out-null cmd / c assoc .sh = sh_auto_file       Batch file: Find if substring is in string (not in a fil...

日文程式/遊戲需要修改的語系設定, change locale setting for Japanese program (game)

圖片
如何執行日文程式,how to run Japanese program? 新一點的程式,大部分都會用unicode,通常沒問題 遊戲因為懶得修正engine? 反正是日本限定,比較不會改用unicode 這時就需要改系統語系設定,否則程式可能無法正常執行 (亂碼或錯誤) 執行後跳出寫日本限定的,猜測是會去檢查你的系統,要用破解 (不在此討論) 在改設定前,建議使用者帳號/遊戲路徑用純英文,不要有中文 一些程式會保存檔案在使用者目錄,中文可能會錯誤 聽到很多人不知道遊戲會有更新 提醒一下,記得去找更新檔安裝 (官網或其他地方) 改系統語系的步驟 https://imgur.com/a/A0KPU 聽說有需要改時區才能啟動的遊戲 (我沒遇過) 用轉區軟體也可以改語系 (不保證可以作用) 為了麻煩,我都直接改日本設定了 要用轉區軟體建議先安裝日文字型,可以先把設定改成日本就會安裝了,裝完再改回來 現在還有更新的轉區軟體,似乎剩這套了 Locale-Emulator 原理是inject dll進process,大概是改變api行為吧 我只用來轉PCMan (想過PCMan改成unicode,可是VS2017有bug無法作業,放棄) 不裝了,PCMan不轉區可在日文語系下顯示中文 我覺得要從一長串中找到日文有點麻煩 執行 LEProc.exe 噴參數,可是看不太懂 "Locale.Emulator\LEProc.exe" -run "PCMan\PCMan.exe" 設定檔在目標目錄 PCMan.exe.le.config 也許沒有像applocale那樣直接指定吧? "Locale.Emulator\LEProc.exe" -runas "一串Guid" "Game.exe" Locale.Emulator\LEConfig.xml   G...

C++ windows build target version

VC++ runtime下載 https://support.microsoft.com/zh-tw/help/2977003/the-latest-supported-visual-c-downloads https://docs.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt NDDI https://msdn.microsoft.com/zh-tw/library/windows/desktop/aa383745(v=vs.85).aspx #define WINVER 0x0601 #define _WIN32_WINDOWS 0x0601  好像是舊的,不用了? 文件找不到,設了應該也不會出事 #define _WIN32_WINNT 0x0601 #define _WIN32_IE  指定IE版本 #define NTDDI_VERSION  NTDDI_WIN7 (0x06010000), _WIN32_WINNT要一起設

OBS Classic 效能強化版 (use newer VS2017, x264) (no support)

以下程式原始碼在github完全公開,我保證無添加惡意程式碼 有人在Discord回報OBS團隊,CLR browser plugin有exploit (OBS classic的plugin) 攻擊者可以在你電腦執行任何程式 別用不維護的OBS classic了,早點換OBS Studio吧 https://craftwarblog.blogspot.com/2017/09/obs-studioby-craftwar.html 詳細情況回報者沒講 我沒在用了,不更新 ,有任何問題自行解決,不要找我 都叫你改用 OBS Studio了,檔案已砍掉 下面可以不用看了 除非記憶體不夠用, 你真的懶到不想重新設定 還是推薦改用新的OBS studio,功能和效能都比較強 (官方版的情況) 因為OBS Classic沒更新,在Win10下無法對應系統更新 game capture的效能OBS Classic < OBS studio OBS Classic官方版完全不推薦,效能會很差 使用舊版的x264有混用SSE2和AVX指令集會大幅降低效能 (x264後來版本有修正) 硬體壓縮是舊版的,新的顯卡似乎不能用 我只是做出較高性能的OBS Classic版本,沒有維護修正bug 我只有幫忙修 OBS studio的bug (部分修正有提交給OBS官方團隊) 我做的OBS Studio修改版 https://craftwarblog.blogspot.com/2017/09/chatty-obs-by-craftwar.html   我做的效能版本比較 (OBS Classic和OBS studio) OBS studio效能會差一點(CPU,ram用量較高,都是可忽略程度) ram用量高是因為 OBS studio只有global source,scenes/sources開太多會用較多 真的在意的話,可以分散到不同scene collection中,減少scenes的數量 需要先下載x86和x64 VS2017 C++的runtime https://support.microsoft.com/help/2977003/the-latest-supported-visual-c-do...

osu! 搜尋電腦中的圖 map filter, integration with discord

https://osu.ppy.sh/help/wiki/Interface Ctrl+f找filter 我比較常用的song list filter cs, ar, od, hp, stars mode - Mode - value can be osu, taiko, catchthebeat, or mania, or o/t/c/m for short. mode=c 就可以找CTB ex: stars>1 stars<4 <>前後不能有空格 不是很好用 遊戲設定擋位置 https://osu.ppy.sh/help/wiki/osu!_Program_Files integrationwith discord https://osu.ppy.sh/forum/t/659856&start=0

Twtich 技術

放起來,有空再看 https://blog.twitch.tv/live-video-transmuxing-transcoding-ffmpeg-vs-twitchtranscoder-part-ii-4973f475f8a3

Android 安裝,設定 紀錄

記錄一下,有些東西無法直接login帳號後還原 以後可能刷機也需要 Magisk module Art Optimization Bellota Font Enable Doze for GMS Magisk Module Single User M od Terminal Emulator Debloater (可用其他GUI app直接砍) 未測試 YouTube Vanced WiFi Bonding Xposed module App Settings 1.1.3xda download(只用來改locale 也許有別套) App Locale (改用AppOps+Xprivacy後,就不需要拔權限,只改locale就夠我用) AppOps 1.29beta10, 新版不能用 Glitchify Gravitybox Greenify MinMinGuard Play Store Changelog RootCloak (可用Magisk內建) TwitchNoAds Xprivacy Xprivacy in App Info Youtube AdAway YoutubeSwipeToSeek disable module when phone can't boot /data/data/de.robv.android.xposed.installer/conf/modules.list https://forum.xda-developers.com/xposed/howto-disable-xposed-modules-via-t3227175 F-Droid AdAway BusyBox Simple IRC

vlc同步播放檔案 ex: osu分開存的video和audio

https://superuser.com/questions/640044/play-two-videos-in-sync-as-well-as-having-seek-in-sync VLC可以在GUI裡面同步放多個media檔 open mutiple-flies ->show more options -> play another ..... 但是有些圖檔是video有聲音 (可能劣質?) 令有一個audio檔的 ,在拉完兩個檔後再參數最前面再加上 --no-sout-display-audio   第二個檔是用--input-slave=  放的 (不用改)

Android Magisk module uninstall

magisk module比xposed module危險,可能會無法開機,解法↓ Uninstall Magisk module offline/without Magisk? Use mount-magisk.zip found in collection of modules thread and delete the folder via twrp in /magisk Magisk Module Uninstaller Flash in recovery (TWRP) Go to TWRP's Terminal/ADB Shell (if you're not usinf twrp 3.x) Type uninmod_magisk 

OpenJDK 32bit設定 jar檔執行(Oracle不提供JDK9 32bit)

https://github.com/ojdkbuild/ojdkbuild https://github.com/ojdkbuild/ojdkbuild/releases   選一個x86的下載 想用32bit的原因在於,效能和64bit差異不大,可是ram用量差很多 64bit jre主要是為了解決ram不夠用的問題,不是效能 Oracle表明不出32bit,只有64bit 唯一解大概是這個了,其他家的OpenJDK都不出32bit Oracle JDK和OpenJDK差別好像就多了一些他們自己的private code 其他地方規格上是相容的 java command line option (找不到openjdk的,就用oracle jdk的來代替,大部份都通用) https://docs.oracle.com/javase/9/tools/java.htm#GUID-3B1CE181-CD30-4178-9602-230B800D4FAE__BABHDABI 設定方法 下載完後找任意地方解壓縮,設定環境變數後就能用了 https://imgur.com/a/Iu1bu 要設定JAVA_HOME的原因是,古老傳統吧,好像還是有Java軟體會去用這變數 設定jar檔關聯直接執行 參考AppVeyor修正 .sh檔的方法,想出下面的方法 https://github.com/alexkasko/openjdk-unofficial-builds/issues/27 在cmd下用管理者權限執行 assoc jar=jarfile ftype jarfile="C:\OpenJDK\jre\bin\javaw.exe" -jar "%1" %* 刪除關聯的方法,同樣要管理者 ftype jarfile= 可用我寫好的sciprt設定 (設完環境變數後,右鍵管理者執行,不用自己打指令,效果一樣) https://github.com/craftwar/scripts/raw/master/Windows/register%20openjdk.cmd

build OBS VS2017

這篇是記錄我編譯產生OBS Studio時的過程,如果你要找的是我做的OBS版本 http://craftwarblog.blogspot.com/2017/09/chatty-obs-by-craftwar.html nvenc的支援在750上,如果header用8.2版本,2018/11/12 OBS的nvenc會無法啟動,改成8.1就ok了 [NVENC encoder: 'streaming_h264'] Failed to open NVENC codec: Function not implemented 1080據說沒有問題,看來是ffmpeg沒做好能力的檢測   作者prebuild的dependencies檔常忘記更新 試著自己更新後發現一些問題 OBS會link到 libx264-*.dll FFmpeg也會link到 libx264-*.dll 如果只compile更新 libx264,就會變成OBS link到新的 FFmpeg官方版會用舊的 libx264 都需要重build才比較不會有問題 ffmpeg不能用 /GL ,否則會出錯 (Dead-code elimination MSVC問題) 即使下了 --disable-runtime-cpudetect,也會在最後失敗 https://trac.ffmpeg.org/ticket/2610 -FORCE:UNRESOLVED也沒辦法過,放棄/GL 因為 libavutil/cpu.c 判斷cpu的長這樣,應該要用 #if 直接濾掉 (x264是這樣做) 提問題的人也是這樣建議,結果ffmpeg拒絕修改,說這是M$的錯 static int get_cpu_flags(void) {     if (ARCH_AARCH64)         return ff_get_cpu_flags_aarch64();     if (ARCH_ARM)         return ff_get_cpu_flags_arm...

build x264 msys2 VS2017

參考資料 http://blog.csdn.net/lifei092/article/details/71687049 開VC shell後 msys64\msys2_shell.cmd -mingw64 -use-full-path CC=cl ./configure --prefix=build --disable-cli --enable-shared obs又沒更新prebuild binary,想用新版就自己google試看看了 msys2的更新 msys2需要安裝make, pkg-conf + [我的用法需要git] pacman -Syu 關掉terminal後 pacman -Su     configure的額外參數 compiler flag 多個include dir就 "-I a -I b" --extra-cflags="-Id:\packages\win64\include" https://msdn.microsoft.com/en-us/library/73f9s62w.aspx   :隔開每個目錄 (linker flag) --extra-ldflags="/LIBPATH:d:\packages\win64\lib"     mingw + msvc 會有一些問題 toolchain不完全相容 ./configure 吃的參數和環境變數,有些是mingw的,有些是msvc的,很麻煩    給configure的參數要用 -,不能用/ 會出錯

Android ze500kl random lose root?

在Magisk 16.6似乎有修正這個bug,原因我忘記了  ASUS_Z00ED = ZE500KL = Z00E 不懂為啥有這麼多編號.... 今天在等火車的時候,發現root又沒了 supersu和root checker都顯示找不到su binary 重開後,root沒回來,xposed的修改都沒了 抓完magisk想刷,想開進recovery沒按好進系統,root又回來了...wtf 10/25 睡醒再次發生,畫面上有goolge play更新的通知 關機後重開解決...大概是root方式有bug 決定換掉supersu用magisk看看 v14可以裝了,以前舊版刷進去都無效,繼續觀察中 magisk還是一樣會發生,電源鍵reboot後恢復 可能相關因素 xposed module update後沒重開 google play更新軟體,或本身 11/7 硬體重開恢復root 猜測跟google play更新有關,關掉instant app看看,反正沒在用

Google Apps Script

https://developers.google.com/apps-script/ 想寫某個東西,和某人討論後發現原來還有google可以用阿 在spreadsheet內的script可以publish as webapp後,就能從網頁上存取 function test() {   var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet(); } 由於權限必須設成固定某人,Nightbot之類的client才能匿名存取 擔心會不會有權限問題,如果他改了script後能存取我的東西 dev版本的code,要經過驗證身份才能使用,應該沒問題 經測試,Google Drive是令一項權限,所以沒問題,不會跑到spreadsheet外 function otherSheet(){  // Get any starred spreadsheets from Google Drive, then open the spreadsheets and log the name  // of the first sheet within each spreadsheet.  var files = DriveApp.searchFiles(      'starred = true and mimeType = "' + MimeType.GOOGLE_SHEETS + '"');  while (files.hasNext()) {    var spreadsheet = SpreadsheetApp.open(files.next());    var sheet = spreadsheet.getSheets()[0];    Logger.log(sheet.getName());  } }

Windows捷徑 給jar檔JVM參數, run jar file with jvm arguments

https://i.imgur.com/K13Xx1y.png 由regedit可找出windows shell對jar檔執行的命令 "C:\Program Files (x86)\Java\jre1.8.0_144\bin\javaw.exe" -jar "%1" %* 因為有%* 我猜測應該能接收到參數 對jar檔建立捷徑後,在目標後加入參數即可 for HotSpot ex: -XX:+AggressiveOpts -da -Xbatch 寫成cmd script直接javaw執行jar也可以,差別在於無法改圖示,除非再建一個捷徑 用 process explorer 可看出command line確實有改變,圖就不附了,懶 如果是包成.exe 檔的Java程式,要看那個程式怎麼設定,不要問我 或是改用jar版本的啟動方式

Twitch 運作機制 實況觀看和上傳的機制說明

圖片
2018/8/10 更新 https://blog.twitch.tv/twitch-engineering-an-introduction-and-overview-a23917b71a25 Twitch的說明+我的實測整理出的結果 實況主用OBS連到的Twitch ingest  server上傳資料 ingest server會把資料再上傳到Twitch(本部也許還有分流? Twitch沒說明)去做處理 Transcode成不同品質,品質source只需要transmux把rtmp轉成hls data center是指實體的硬體設施 (包含空調,網路,電,電腦) 觀眾看實況連到的server在twitch叫edge edge是一群server,不一定會連到哪一個,看同一實況的人也可能連到不同edge edge server address大概長這樣 video-edge-c2a244.lax03.hls.ttvnw.net  <-us video-edge-a24f84.sfo01.hls.ttvnw.net  <-us video-edge-da0b30.tpe01.hls.ttvnw.net <-tw 剛開始看的人都必需連到us去要資料 可能大台例外一開始就有分流 (簽約實況主? 保證有一定觀眾數) 如果tw區域有足夠多人在看,Twitch就會給tw區edge資料,做為分流 後面的人就會連到tw server去,不是一開始的us 一開始連us的人,會不會被自動轉到tw去? (不確定,我猜twitch應該有這技術) 觀眾看台用哪一個server跟實況主的設定無關 Twitch在台灣建置data center後 有人說台灣終於有Twitch server,不用連到國外去看了 基本上是對的,除了小台 (前面解釋過了) 實況主上傳到Twitch的資料,Twitch會處理後提供不同品質可以選擇 (re-encoding) 如果你的台沒這個功能,可能是觀眾數不夠Twitch沒提供 panter一定可以調畫質,affiliate只有優先使用權 https://help.twitch.tv/customer/portal/articles/2785927-joinin...

Hinet Zyxel P874 VSDL modem, no IPv6?

https://imgur.com/a/I70GI http://interop.ipv6.org.tw/2010TaiwanIPv6ReadyLogoListPhase2.htm https://www.ipv6ready.org/?page=phase-2-tech-info 韌體版本: P874N7_TR069_20140730 前陣子進過P880的介面就有發現可設定IPv6 P874通過中華電信研究院的測試 IPv6 Ready 認證有Host/Router,理論上應該能開 我猜是沒寫Web介面? 只能用軟體開? 或是firmware根本沒這功能,測試只測硬體orz 不過IPv6後,還會拿到private IP,經過NAT再出去嗎? 直接出去就增加風險阿

Twitch 實況只聽聲音 (audio only mode)

官方的Twitch網頁是不支援的,但是手機app有這個功能 這就表示其實是有個stream只有聲音的 用Streamlink就能抓到這個audio only stream 資源用量會比平常低 (少掉畫面的部分) 作業中把別人台當bgm很好用的功能 Streamlink的使用方法參考,我之前寫的文 Chatty介紹及教學 Streamlink+VLC 同時觀看數個Twitch實況 或是用Android模擬器裝twitch app也可以辦到,只是系統負擔會比較大   最後的方法,在播放器中關掉畫面,減輕系統負擔只處理聲音 (流量不會減少,還是會全抓) ex: VLC

Qt and VS2017 32bit

圖片
據說VS2015 VS2017 ABI相容,所以Qt似乎不打算令外出2017的 要產生VS2017 32bit build Qt Creator內要改設定才能用到2015 要設定2017的compiler (應該要能自動抓才對?) AppVeyor的狀況 (目前還沒把 msvc2015放進VS2017的image,沒得用) Build started cd C:\Qt\5.9 dir Volume in drive C has no label. Volume Serial Number is 1CB8-D4AA Directory of C:\Qt\5.9 07/04/2017 01:52 PM <DIR> . 07/04/2017 01:52 PM <DIR> .. 07/04/2017 01:53 PM <DIR> msvc2017_64 07/04/2017 01:51 PM <DIR> winrt_armv7_msvc2017 07/04/2017 01:52 PM <DIR> winrt_x64_msvc2017 07/04/2017 01:52 PM <DIR> winrt_x86_msvc2017 0 File(s) 0 bytes 6 Dir(s) 27,699,412,992 bytes free

AppVeyor VS2017 vcvars

https://github.com/appveyor/ci/issues/1410#issuecomment-301512389 https://www.appveyor.com/docs/build-environment/#choosing-image-for-your-builds call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars32.bat" call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"   https://www.appveyor.com/docs/lang/cpp/