Repository navigation
feat(spectator): 観戦者が任意のタイミングで途中参加できるようにする #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
progre
wants to merge
21
commits into
main
Choose a base branch
from
claude/funny-lamport-c1rav2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
4945000
feat(spectator): 観戦者が任意のタイミングで途中参加できるようにする
claude d329696
refactor(spectator): レビュー指摘を反映して可読性を改善
claude f8b7908
refactor(spectator): 設計レビューを反映して整理
claude 7491044
feat(spectator): 接続時点の状態を送る方式に変更し、観戦用プロトコルを分ける
claude 95f9cd2
feat(spectator): 試合開始時の状態に合わせて観戦を始める方式に変更
claude 0fe6dbd
fix(spectator): 再レビューの指摘を反映
claude 197c120
feat(spectator): 試合中に接続した観戦者は試合の最初から早送りで追いかける
claude fd0cf94
refactor(spectator): 次の試合の InitGame をバッファの先頭に戻して保持する
claude e7ef63c
chore(spectator): カードの選択状態の保持場所を調べる一時的な診断ログを追加
claude 718716e
Revert "chore(spectator): カードの選択状態の保持場所を調べる一時的な診断ログを追加"
claude 85e0399
fix(spectator): カードを入力で選ばせて同期する
claude 29947ec
fix(spectator): カードの切り替えが受け付けられたことを確認しながら入力する
claude e6374f3
fix(spectator): ホストが送るカードを vs_mode の値にする
claude ed85689
chore(spectator): カードの値の場所を調べる診断ログを再度追加
claude d62918d
fix(junowen-lib): Player のカードの位置を +94h に直す
claude b40fe10
fix(spectator): 試合中に観戦を始めたときに早送りで追いかける
claude ed432d8
chore(spectator): 早送りが効かない原因を調べる一時的な診断ログを追加
claude 56fc4c2
feat(spectator): 早送り中は画面の表示を間引いて追いつく
claude a87f850
refactor(junowen-lib): PeerConnection の protocol を引数で受け取る形に変更
progre 2c34946
chore(spectator): 早送りの原因調査用の診断ログを削除
progre 50a2987
refactor(spectator): present_skipper のグローバル変数を観戦セッションの状態へ移動
progre File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,16 +3,16 @@ use std::mem::transmute; | |
| use anyhow::{Result, bail}; | ||
| use getset::{Getters, MutGetters}; | ||
|
|
||
| /// length=c0 | ||
| /// length=c8 | ||
| #[repr(C)] | ||
| pub struct Player { | ||
| _unknown1: [u8; 0x0c], | ||
| /// NOT available on player select screen | ||
| pub character: u32, | ||
| _unknown2: [u8; 0x80], | ||
| /// Available on player select screen | ||
| _unknown2: [u8; 0x84], | ||
| /// Available on player select screen (+94h) | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 何を根拠に位置を変えたのですか?(+94h は自明なので書かないでください) |
||
| pub card: u32, | ||
| _unknown3: [u8; 0x34], | ||
| _unknown3: [u8; 0x30], | ||
| } | ||
|
|
||
| #[derive(Clone, Copy, PartialEq)] | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
junowen/src/custom_direct_3d/direct_3d_device_event_listener.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| use windows::Win32::Graphics::Direct3D9::IDirect3DDevice9; | ||
|
|
||
| pub trait Direct3DDeviceEventListener { | ||
| /// 表示を間引く場合は `true` を返す | ||
| fn should_skip_present(&self) -> bool; | ||
| fn on_before_present(&self, device: &IDirect3DDevice9); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| //! 観戦者がホストに追いつくまでの早送り中は、画面の表示 (`Present`) を間引く | ||
| //! | ||
| //! 試合中は、ゲームの no wait 設定を有効にしても処理が速くならない。 | ||
| //! 表示のたびに垂直同期を待つため、1 秒あたり 60 フレームに抑えられていると考えられる。 | ||
| //! そこで表示を間引き、この待ちを減らす。 | ||
|
|
||
| use std::sync::atomic::{AtomicU32, Ordering}; | ||
|
|
||
| /// 早送りを要求されてから、表示を間引き続けるフレーム数。 | ||
| /// 要求が途絶えたら (セッションが終了した場合など) すぐに通常の表示に戻す | ||
| const SKIP_FRAMES_PER_REQUEST: u32 = 2; | ||
| /// 間引いている間も、このフレーム数ごとに1回は表示する | ||
| const PRESENT_INTERVAL: u32 = 8; | ||
|
|
||
| #[derive(Default)] | ||
| pub struct PresentSkipper { | ||
| remaining_frames: AtomicU32, | ||
| counter: AtomicU32, | ||
| } | ||
|
|
||
| impl PresentSkipper { | ||
| /// 早送り中は毎フレーム呼ぶ | ||
| pub fn request_skip(&self) { | ||
| self.remaining_frames | ||
| .store(SKIP_FRAMES_PER_REQUEST, Ordering::Relaxed); | ||
| } | ||
|
|
||
| /// 表示を間引く場合は `true` を返す | ||
| pub fn should_skip_present(&self) -> bool { | ||
| let requested = self | ||
| .remaining_frames | ||
| .fetch_update(Ordering::Relaxed, Ordering::Relaxed, |x| x.checked_sub(1)) | ||
| .is_ok(); | ||
| if !requested { | ||
| return false; | ||
| } | ||
| !self | ||
| .counter | ||
| .fetch_add(1, Ordering::Relaxed) | ||
| .is_multiple_of(PRESENT_INTERVAL) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.