diff options
Diffstat (limited to 'content')
-rw-r--r-- | content/blue-blood-lagoon/bgm-header.png | bin | 0 -> 160839 bytes | |||
-rw-r--r-- | content/blue-blood-lagoon/index.md | 27 | ||||
-rw-r--r-- | content/mingw-code-golfing-quirks/asm_diff.png | bin | 0 -> 180641 bytes | |||
-rw-r--r-- | content/mingw-code-golfing-quirks/correct_output.png | bin | 0 -> 190224 bytes | |||
-rw-r--r-- | content/mingw-code-golfing-quirks/erroneous_output.png | bin | 0 -> 149310 bytes | |||
-rw-r--r-- | content/mingw-code-golfing-quirks/index.md | 70 | ||||
-rw-r--r-- | content/mingw-code-golfing-quirks/xmm1.png | bin | 0 -> 221637 bytes | |||
-rw-r--r-- | content/scheduled-idling/index.md | 15 |
8 files changed, 112 insertions, 0 deletions
diff --git a/content/blue-blood-lagoon/bgm-header.png b/content/blue-blood-lagoon/bgm-header.png Binary files differnew file mode 100644 index 0000000..f49cc15 --- /dev/null +++ b/content/blue-blood-lagoon/bgm-header.png diff --git a/content/blue-blood-lagoon/index.md b/content/blue-blood-lagoon/index.md new file mode 100644 index 0000000..87a17a3 --- /dev/null +++ b/content/blue-blood-lagoon/index.md @@ -0,0 +1,27 @@ ++++ +title = "她和他和她的澎湖湾" +date = 2025-06-26 +authors = ["135e2 (Mole Shang)"] +[taxonomies] +tags = ["ACGN", "游戏"] ++++ + +花了 685 天(是的你没看错)终于通关了题作。 + + + +碍于班固米的短评空间太小了写不下,暂且将零碎的感想扔在这里,等有闲心时再做系统整理。 + +<!-- more --> + +--- + +选材真的好棒,不如说古今中外以这种历史伤痛为背景的创作都是同类里极少见的,特殊到感觉难以归入任何已有的门类。在传统男性视角为主的 Galgame 作品框架里大谈女性觉醒,咱也不懂它这受众到底是谁。(不过说到底除了出于见证好奇的原因真的有人会无聊到听说这游戏吗) + +作画、配音和配乐总体算是不错,虽说肉眼可见的预算贫瘠,内容不少还是耐听耐看的。 + +中期剧情模板化太过严重,公式之每天上学臭标志神仙对骂三百回合,能忍住不按 Ctrl 的也是神人了。感觉全流程 100 个小时里有接近三分之一时间都是在听这些废话,血压控制练习属于是。怪不得断断续续推了两年才结束。 + +抛开日常讲道理(对骂)的部分不看,高潮情节的设计和时不时的抖书袋还是挺让人喜欢的,脚本的国学与文字功底也只有在这些地方才能尽数显露;无论如何,「澎湖湾」永远是一个只有中国(如果你还宽泛地认同某某共识的话)人才能做出来的游戏。 + +建议所有所谓的“国Gal制作人”都来读一遍再去写你们那勾八脚本。 diff --git a/content/mingw-code-golfing-quirks/asm_diff.png b/content/mingw-code-golfing-quirks/asm_diff.png Binary files differnew file mode 100644 index 0000000..6757c99 --- /dev/null +++ b/content/mingw-code-golfing-quirks/asm_diff.png diff --git a/content/mingw-code-golfing-quirks/correct_output.png b/content/mingw-code-golfing-quirks/correct_output.png Binary files differnew file mode 100644 index 0000000..fda3079 --- /dev/null +++ b/content/mingw-code-golfing-quirks/correct_output.png diff --git a/content/mingw-code-golfing-quirks/erroneous_output.png b/content/mingw-code-golfing-quirks/erroneous_output.png Binary files differnew file mode 100644 index 0000000..1f47bf5 --- /dev/null +++ b/content/mingw-code-golfing-quirks/erroneous_output.png diff --git a/content/mingw-code-golfing-quirks/index.md b/content/mingw-code-golfing-quirks/index.md new file mode 100644 index 0000000..464b767 --- /dev/null +++ b/content/mingw-code-golfing-quirks/index.md @@ -0,0 +1,70 @@ ++++ +title = "MinGW, x86_64 调用规范与代码高尔夫" +date = 2025-03-28 +authors = ["135e2 (Mole Shang)"] +[taxonomies] +tags = ["技术"] ++++ + +最近和友人研究短码竞赛,用 MinGW 跑测试的时候出现了诡异的现象,在此留作记录。 + +<!-- more --> + +由于常用的短码 OJ 均使用 [TCC](https://www.bellard.org/tcc/) 编译,自然为了模拟其行为,并节省字符数,我们选择了 C90 标准(不强制要求声明函数签名)并开启了 `-fno-builtin` 编译选项(以忽略烦人的编译器警告)。 + +跑了几段测试后,黑魔法出现: + + + +一开始我们都觉得是 MinGW 犯了什么毛病,于是拉进 GDB 里一通猛调: + +根据 [Windows x64 calling convention](https://learn.microsoft.com/en-us/cpp/build/x64-calling-convention?view=msvc-170#example-of-argument-passing-2---all-floats),`printf`函数的第二个浮点参数应当存在 `$xmm1` 中,调试一下却发现已经正确写入。 + + + +用 GDB 跳进 `printf` 实现里大概翻了一下,也没有注意到什么奇怪的地方。将各种寄存器倒腾一番之后,依然百思不得其解。 + +友人突然想起来看看编译参数;删掉 `-fno-builtin` 之后,尽管多了不少警告,MinGW 突然产出了正确的结果: + + + +那么问题来了:开不开 builtin 和 `printf` 的输出结果有什么关系? + +~~又到了喜闻乐见的编译原理检测时间~~ + +GCC 文档如此解释 `no-builtin` 选项: +``` +-fno-builtin +-fno-builtin-function + + Don't recognize built-in functions that do not begin with + __builtin_ as prefix. GCC normally generates special code to + handle certain built-in functions more efficiently; for + instance, calls to "alloca" may become single instructions + which adjust the stack directly, and calls to "memcpy" may + become inline copy loops. The resulting code is often both + smaller and faster, but since the function calls no longer + appear as such, you cannot set a breakpoint on those calls, nor + can you change the behavior of the functions by linking with a + different library. In addition, when a function is recognized + as a built-in function, GCC may use information about that + function to warn about problems with calls to that function, or + to generate more efficient code, even if the resulting code + still contains calls to that function. For example, warnings + are given with -Wformat for bad calls to "printf" when "printf" + is built in and "strlen" is known not to modify global memory. +``` + +再次仔细阅读 [Windows x64 calling convention](https://learn.microsoft.com/en-us/cpp/build/x64-calling-convention?view=msvc-170#varargs),注意到 `Varargs` 一节有这么一行小字: + +> For floating-point values only, both the integer register and the floating-point register must contain the value, in case the callee expects the value in the integer registers. + +如此对比两者产生的汇编,理由就很容易想清楚了: + + + +显然我们在没有函数签名定义的情况下,又开启了 `no-builtin` 选项,编译器因而无从获取 `printf` 的签名信息,只能从调用推断其签名为 `void printf(const char*, double)`,无法遵循正确的 `varargs` 调用规范设置通用寄存器 `$rdx`,导致 Windows 运行时标准库中的 `printf` 作为 callee 获取第二个参数时永远是全0(`$rdx` 原值);而一旦关闭这一选项,即使不写签名,编译器也能通过内建的函数匹配机制获得完整的 `printf` 签名信息(`int printf(const char*, ...)`),便能生成正确的汇编调用设置 `$rdx`,结果也自然没有问题了。 + +C,很奇妙吧。 xDDD + +> Compiler Explorer 复现链接: https://godbolt.org/z/eh9WK9eqG diff --git a/content/mingw-code-golfing-quirks/xmm1.png b/content/mingw-code-golfing-quirks/xmm1.png Binary files differnew file mode 100644 index 0000000..009719c --- /dev/null +++ b/content/mingw-code-golfing-quirks/xmm1.png diff --git a/content/scheduled-idling/index.md b/content/scheduled-idling/index.md new file mode 100644 index 0000000..4c2af1a --- /dev/null +++ b/content/scheduled-idling/index.md @@ -0,0 +1,15 @@ ++++ +title = "计划性空转" +date = 2025-03-23 +authors = ["135e2 (Mole Shang)"] +[taxonomies] +tags = ["随想"] ++++ + +> Surely idling is about doing what you feel? No, because if you do not schedule your idling, you will be easy prey for the attention merchants out there, the Silicon Valley platforms and scams, the advertising people, the distractors, who spend vast sums employing behavioural scientists to get you to hang around on their sites, clicking and spending. In scheduling is freedom. +> +> -- An Idler's Manual, Tom Hodgkinson + +可直觉上还是觉着「有计划地空转」是件挺不可理喻的事。 + +<!-- more --> |