r/opencode • • 3d ago

Thank you Tencent and Opencode!

Post image

Thank you so much Tencent and Opencode for making this possible. I worked on a byte perfect nds decomp and it helped me so much! I went from 5% up to 80% within two weeks.

My usage of this model is now exhausted. I hit rate limits now.

332 Upvotes

49 comments sorted by

7

u/SkyLordOmega 3d ago

Can you give an Eli5 of what you were trying to achieve here - what is byte perfect nds decomp.

6

u/UnbegrenzteMacht 3d ago

I am decompiling the game. But when I Compile it from my sources, I want it to be Byte-identical to the original Game. That means my Code builds the identical rom.

You can look at sm64ds-decomp on github which acheived this for Mario 64 DS

1

u/Healthy_Stable1295 3d ago

I am curious what the prompt used is, can you send it to me?

2

u/UnbegrenzteMacht 3d ago

I will write it up later or tomorrow.

2

u/UnbegrenzteMacht 1d ago

It is not a single prompt I use. I had a whole toolchain ready before Hy4-F went free.

- This is all very simplefied. you can look at github sm64ds-decomp which has 100% match with Super Mario 64. I build my own toolchain.

- I use ds-decomp to delink my rom. I get binary files.
- I do have a oracle which i check with "python game.py match function_name" That tool compares my candidate function with the target fuction. I get match = true or match = false

Now I had two prompts. Both of them take a chunk of functions.

Prompt 1: Size match. I want the candidate function to have the same size as the target. This alone helps me a lot after Hy-F isnt unlimited anymore.

/goal Run the size pass for this chunk: `<CHUNK_PATH>`

**Chunk:** `<CHUNK_PATH>`

**Objective:** Reconstruct every target function as editable C that compiles with the designated project toolchain, preserves the original behavior, and produces exactly the same code size. Byte matching is not required. Use the existing candidate as a starting point, not as code you must preserve unchanged.

## Project rules

  • Read the applicable `AGENTS.md` files and project instructions before making changes. Use the existing directory structure, filenames, types, headers, and build workflows. Edit candidates in place. Do not create a parallel directory structure, a manifest, or an additional status file.
  • Do not modify functions outside the chunk or alter existing byte matches. Do not enable candidates in the default ROM build. Do not merge or push.
  • The reconstruction must be in C. Assembly is permitted only for `msr`, `dcd`, and `swi`.
## Workflow for each function 1. Unambiguously map the candidate to its original function. Use the original disassembly as the reference. Use m2c and Ghidra as aids; if they disagree with the original disassembly, the original disassembly takes precedence. 2. Try to build the candidate. If it does not compile, fixing the build is the next task, not a reason to stop. Analyze the compiler diagnostics and verify declarations, types, signatures, and dependencies against the repository and the original. Fix incorrect code rather than commenting it out or replacing it with placeholders. 3. Once the candidate builds, measure its code size using the project's definition. If it differs from the original, compare the generated disassembly with the original, focusing on control flow, calls, memory accesses, and stack usage. Use those differences to make targeted changes to the C code, then rebuild and measure again. If a change does not help, test the next hypothesis supported by the evidence rather than rewriting the code at random. 4. Do not use size hacks in either direction. Do not add padding, NOPs, no-op operations, or artificial memory accesses just to add bytes. Do not remove original logic, checks, calls, memory accesses, or side effects just to save bytes. You may remove unnecessary code that the candidate incorrectly introduced if the original supports the correction. Do not change global compiler flags or linker rules to force the target size. 5. Keep working on the function until a successful build yields a 0-byte delta and the reconstruction is still supported by the original. There is no fixed attempt limit. A compile error, a remaining size delta, or several unsuccessful variants are not blockers. A genuine blocker is, for example, a missing original or an unavailable toolchain that cannot be restored through the designated project workflow. Identify the specific blocker and continue with the other functions in the chunk. ## Additional constraints
  • Use subagents to parallelize independent work where possible.
  • Do not modify the toolchain. Use only the pinned CodeWarrior version and the prescribed flags. Do not try other versions or flag combinations.
## Completion Report the chunk as complete only when every target function has built successfully and measured a 0-byte delta. If a genuine blocker remains, report the chunk as incomplete and identify the affected function, its last verified state, and the specific blocker. A 0-byte delta is not a byte match and does not verify the final ROM slot. Do not start the next chunk on your own

Prompt 2:

Actual matching on chunks:

/goal CHUNK = every function listed in <CHUNK_FUNCTION_LIST_PATH>
Get game match = true for every function in CHUNK using pure C, the project's pinned CodeWarrior version, and the actual project build settings. Run unattended: do not ask me for decisions or approval, and do not wait for a reply.
Supervision and parallel work
Act as the supervisor. Inventory the functions, assign independent functions to workers in parallel, and give each function exactly one writer.
Own integration, final verification, and updates to shared documentation.
You may inspect <PRIOR_WORK_PATH> for previous work, probes, and matching examples.
Do not stop the chunk because a worker stalls or a function is difficult. Keep working on other functions while investigating blocked ones.
Matching workflow
0. Check semantics first for every function.
Establish the current game match result and the target-vs-generated disassembly diff for each function. Preserve the best verified pure-C candidate and make experiments reversible.
Work from the first meaningful divergence in the diff, not just the mismatch count or a mnemonic in the target. State a concrete hypothesis, test it, and record what changed. When investigating instruction selection, account for operand liveness, flag consumers, branch layout, and surrounding code. Validate promising minimal probes in the actual function.
If a strategy stalls, switch to a materially different hypothesis. Inspect comparable matching C code and have an independent worker review the target and the best candidate. Ask for a competing explanation or a test that distinguishes between explanations, not more syntax variants of the same expression. Run that test before parking the function if feasible.
Before claiming CodeWarrior cannot emit an instruction, search rebuilt pure-C objects produced with the pinned configuration. Exclude inline ASM, whole-function ASM, DCD, prebuilt objects, and retail disassembly as evidence of C code generation. Trace any hit to its C source and verify the build settings. Treat TST and CMN as separate questions. Failed searches and probes mean “not observed,” not “cannot emit.”
Do not add ASM, inline ASM, DCD, or raw instruction encodings as a matching workaround during this run. Leave the best verified C candidate in place and move on.
<ASM_USAGE_DOC_PATH> tracks actual ASM usage only. Do not add proposed exceptions there. If a function already has an ASM match, report it separately; it does not count toward the pure-C goal.
Parking and retrying
Park a function only after reviewing the actual diff, testing a different hypothesis, and getting an independent review. A missing mnemonic in probes is not, by itself, a reason to park it.
For each parked function, record the remaining divergence, what was ruled out, and the next concrete experiment.
Revisit parked functions when another worker finds relevant evidence or when active work is exhausted and a meaningful untried experiment remains.
Do not repeat equivalent probes just to stay busy. Do not end the run while an actionable experiment remains and execution can continue.
Documentation and completion criteria
In each function's Markdown file (<FUNCTION_DOC_PATH>), record the baseline, the best verified C result, the actual remaining diff, the distinct hypotheses tested, and the reproduction commands.
After a pure-C candidate achieves game match = true, re-verify it after integration, then add the function to <FULL_MATCH_DOC_PATH>.
Report CHUNK as complete only if every function verifies from pure C.
If the run ends before completion, preserve the best verified work and report verified C matches, existing ASM matches, parked functions, proposed ASM exceptions, and uninvestigated functions separately. Leave a concrete next step for every unfinished function. Report these as findings, not questions.
Do not bank or gate matches in this run. Record them only in the Markdown files.

I pretty much let these prompts run 24/7

2

u/Pretend-Pangolin-846 3d ago

It's an emulator for roma from nintendo, byte perfect is ai lingo for decompilation without constructing approximate modules.

4

u/ApprehensiveDelay238 3d ago

How much did it cost you?

20

u/UnbegrenzteMacht 3d ago

I am only subscribed to 10$ Go Plan and I used the free Model.

2

u/Valuable-Laugh6239 3d ago edited 3d ago

I am thinking of buying the $10 go plan as well. Can you tell me if this usage is what you get by default with deepseek or do you have to do some optimization etc. I need a daily coder as well and i am tired of cluade limited usage.

5

u/UnbegrenzteMacht 3d ago

This is Not deepseek. It is Hy4-Flash free which had a unlimited usage for 2 weeks. It ends tomorrow or today

→ More replies (1)

2

u/ApprehensiveDelay238 3d ago

How on earth do you get 53B tokens out of that? I'd be happy with 4B a month on my go sub and use DSH with 95% cache.

3

u/bwrayne 3d ago

As OP said in a previous reply:

"This is Not deepseek. It is Hy4-Flash free which had a unlimited usage for 2 weeks. It ends tomorrow or today"

→ More replies (1)

1

u/FermiGBM 2d ago

Oh I see

21

u/fapmasterr69 3d ago

Hy4 flash is really good, but it tends to repeat mistakes unknowingly so you must set hard rules for it to follow.

18

u/PsycRisk_404 3d ago

and here i thoughy my record of 52.2B wouldnt be beat

5

u/breadnone 3d ago

hy4 flash free is actually good if you write proper rules and guardrails for them

5

u/AdeptDistribution143 3d ago

I don’t understand the enthusiasm for this model. Every review ends up uncovering a bunch of errors. You can only use it by following a cycle of step-review-step-review...

2

u/codeVerine 2d ago

Use it as a worker

1

u/Savings_Cloud5486 3d ago

I reverse 5 games at once and would never reach so much tokens,

1

u/UnbegrenzteMacht 3d ago

I am going for a byte match. That means the rom I build must be identical to the original rom

1

u/FermentedKarma 3d ago

How you did it, using that REA or something else?

3

u/UnbegrenzteMacht 3d ago

I used ds-decomp

3

u/HeadLeadership8763 3d ago

DeepSeek is the future

2

u/Familiar-Buy-6631 3d ago

bro, opencode gives you unlimited usage on free models? in just $10

4

u/OptimalLengthiness42 3d ago

wild times we live in. "Unlimited" is a bit of a stretch but yeah, unlimited within reason for sure as you can see.

1

u/bbqfetus 2d ago

There's still rate limits

1

u/saleheen-dev 3d ago

How is the result of Hy4 F as compared to DS v4.1 F?

5

u/AdeptDistribution143 3d ago

DS is smarter at coding.

1

u/Frosty_Ant7239 3d ago

How did you get the stats screen?

2

u/OptimalLengthiness42 3d ago

`/stats` in opencode cli I believe

1

u/Fresh_Effective_884 3d ago

All of this was in the unlimited era or just with the 10$ suscription?

1

u/mugigi1 2d ago

Haha me too, i'm doing a PS2 decomp, i use claude pro as orchestrator and opencode hy4 as dev. Perfect combination

1

u/Any-Day-4682 1d ago

Unrelated, but I need to know what is the cheapest/free model that I can use with opencode? I use neon and hydrogen (ai studio and agy cli) to create plans but implementing with hydrogen seems to be a wast of token, since 3.8 will be gone soon, I am looking for alternate options. Is there anything available at opencode?

1

u/flexrc 3d ago

Is tencend a good model? What is the full name?

4

u/bdhackers009 3d ago

Ig he is referring to hy4 flash freee on opencode go

4

u/flexrc 3d ago

How does it compare to DeepSeek flash? I tried beam before but it was so bad so I don't want to risk :)

8

u/aalopaneer 3d ago

Hy4 Flash is actually good I using it and it feels like unlimited access to it. It is not good as deepseek but it's actually good and speed is also amazing.

2

u/flexrc 3d ago

Good to know. How are you using it and making sure that it won't mess things up?

2

u/aalopaneer 3d ago

I am working on a Flutter Project which my freelancing project and before trying with any opencode model i tested it with the small projects and I found deepseek limit get hit soon because of too many files and I found the hy4 flash is good because of context window it run through multiple files but didn't hallucinate in my case and I think there is promotional offer or something that's why it's near to unlimited till today means 30th of Nov. It strictly follow the instructions and in any next prompts if I ask it to do something which I previously told it not to do it confirms again that i really wanted to do this or not. I am trusting it with my actual project.

→ More replies (2)

2

u/NEROisADRIO 3d ago

Not a good decision maker so I use others so it can just follow them

1

u/Dodokii 3d ago

For daily driver it is very good. For complex task you need another model to make a detailed and well gated plan. And it will execute nicely!

1

u/Familiar-Buy-6631 3d ago

you can use this hy4 model for free in hermes

0

u/yusuf_delvi 3d ago

how is it compare to deepseek v4.1 flash.
This week even under heavy usage it didn’t reach my 5 hour or weekly window